Quantcast
Channel: Windows Mobile – .NET Compact Framework (VB, C#) フォーラム
Viewing all articles
Browse latest Browse all 80

多重起動について

$
0
0

はじめまして。nakayoshiと申します。

.netは初心者で試行錯誤で社内で利用するWindowsMobile6.5端末の開発をしています。

開発したアプリケーションを登録し、スタートからアイコンをタップすると、無事思った通りの動作をしています。

しかし、他の人にテストしてもらったときに、起動はダブルクリックのようにやると思い、

アイコン連打したところ、複数立ち上がってしまいました。

そこで、ネット上で調査して下記コードを書いてみましたが効果がありません。

どこが悪いのかわかりません。

何分初心者なので見当違いなのかもよく分かってませんが、ご教授下さい。

スタートアップオブジェクトはSub Mainとしました。

PublicClass Strat'=============================='スタートクラス'==============================SharedSub Main()'多重起動チェックConst ERROR_ALREADY_EXISTS AsInteger = 183If CreateMutex(IntPtr.Zero, True, System.Reflection.Assembly.GetExecutingAssembly().GetName().Name) <> 0 ThenIf GetLastError() = ERROR_ALREADY_EXISTS Then
        MessageBox.Show("すでに起動しています。", "メッセージ")
        Application.Exit()EndIfEndIf'FRM_MENUを開く
    Application.Run(New FRM_MENU())EndSub<DllImport("CoreDll.Dll")> PrivateSharedFunction GetLastError() AsIntegerEndFunction<DllImport("CoreDll.Dll", EntryPoint:="CreateMutexW")> PrivateSharedFunction CreateMutex(ByVal lpMutexAttributes As IntPtr, ByVal InitialOwner AsBoolean, ByVal MutexName AsString) AsIntegerEndFunctionEndClass

Viewing all articles
Browse latest Browse all 80

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>