求助各位帮忙看看CreateMutex怎么用OD调不了
来源:互联网 发布:信息发布网源码 编辑:程序博客网 时间:2024/04/29 06:09
代码:
#define _CRT_SECURE_NO_WARNINGS
#include <windows.h>
#include <string>
#include <stdio.h>
#include <Dbt.h>
#include <iostream>
#include "io.h"
#include "tlhelp32.h"
#include "stdio.h"
#include <tchar.h>
#include <conio.h>
#include <fstream>
using namespace std;
HANDLE hOneInstanceMutex;
LRESULT CALLBACK WndProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam);
int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
hOneInstanceMutex = NULL;
hOneInstanceMutex = ::CreateMutex(NULL, FALSE, _T("113fd4dce30d7d8e2d1c4f2211cd164e1"));
if(GetLastError() == ERROR_ALREADY_EXISTS)
{
hOneInstanceMutex = NULL;
MessageBox(NULL,TEXT("已存在113fd4dce30d7d8e2d1c4f2211cd164e1的互斥体"),TEXT("提示"),0);
return 0;
}
else
{
MessageBox(NULL,TEXT("启动成功"),TEXT("提示"),0);
}
WNDCLASS wndclass;
wndclass.cbClsExtra=0;
wndclass.cbWndExtra=0;
wndclass.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
wndclass.hCursor=LoadCursor(NULL,IDC_ICON);
wndclass.hIcon=LoadIcon(NULL,IDI_ASTERISK);
wndclass.hInstance=hInstance;
wndclass.lpfnWndProc=WndProc;
wndclass.lpszClassName="U";
wndclass.lpszMenuName=NULL;
wndclass.style=CS_VREDRAW|CS_HREDRAW;
RegisterClass(&wndclass);
HWND hwnd;
hwnd=CreateWindow("U","",WS_OVERLAPPEDWINDOW,150,150,683,384,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,SW_HIDE);
UpdateWindow(hwnd);
MSG msg;
while(GetMessage(&msg,hwnd,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
LRESULT CALLBACK WndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
switch(uMsg)
{
case WM_PAINT:
{
PAINTSTRUCT ps;
BeginPaint(hwnd,&ps);
EndPaint(hwnd,&ps);
break;
}
case WM_CLOSE:
{
return FALSE;
break;
}
case WM_DESTROY:
{
return FALSE;
break;
}
default:
{
return DefWindowProc(hwnd,uMsg,wParam,lParam);
break;
}
}
return 0;
}
用OD调试的时候,Ctrl+N里有,回车进去断点,,然后F9运行,程序没停下来
#define _CRT_SECURE_NO_WARNINGS
#include <windows.h>
#include <string>
#include <stdio.h>
#include <Dbt.h>
#include <iostream>
#include "io.h"
#include "tlhelp32.h"
#include "stdio.h"
#include <tchar.h>
#include <conio.h>
#include <fstream>
using namespace std;
HANDLE hOneInstanceMutex;
LRESULT CALLBACK WndProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam);
int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
hOneInstanceMutex = NULL;
hOneInstanceMutex = ::CreateMutex(NULL, FALSE, _T("113fd4dce30d7d8e2d1c4f2211cd164e1"));
if(GetLastError() == ERROR_ALREADY_EXISTS)
{
hOneInstanceMutex = NULL;
MessageBox(NULL,TEXT("已存在113fd4dce30d7d8e2d1c4f2211cd164e1的互斥体"),TEXT("提示"),0);
return 0;
}
else
{
MessageBox(NULL,TEXT("启动成功"),TEXT("提示"),0);
}
WNDCLASS wndclass;
wndclass.cbClsExtra=0;
wndclass.cbWndExtra=0;
wndclass.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
wndclass.hCursor=LoadCursor(NULL,IDC_ICON);
wndclass.hIcon=LoadIcon(NULL,IDI_ASTERISK);
wndclass.hInstance=hInstance;
wndclass.lpfnWndProc=WndProc;
wndclass.lpszClassName="U";
wndclass.lpszMenuName=NULL;
wndclass.style=CS_VREDRAW|CS_HREDRAW;
RegisterClass(&wndclass);
HWND hwnd;
hwnd=CreateWindow("U","",WS_OVERLAPPEDWINDOW,150,150,683,384,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,SW_HIDE);
UpdateWindow(hwnd);
MSG msg;
while(GetMessage(&msg,hwnd,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
LRESULT CALLBACK WndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
switch(uMsg)
{
case WM_PAINT:
{
PAINTSTRUCT ps;
BeginPaint(hwnd,&ps);
EndPaint(hwnd,&ps);
break;
}
case WM_CLOSE:
{
return FALSE;
break;
}
case WM_DESTROY:
{
return FALSE;
break;
}
default:
{
return DefWindowProc(hwnd,uMsg,wParam,lParam);
break;
}
}
return 0;
}
用OD调试的时候,Ctrl+N里有,回车进去断点,,然后F9运行,程序没停下来
0 0
- 求助各位帮忙看看CreateMutex怎么用OD调不了
- struts配置异常,各位大侠帮忙看看
- 求助请大侠,帮忙看看是什么问题
- D-Day +6 of .NET 传说中的计算器问题.有BUG,解决不了,第一个程序怎么就调不好呢,高手帮忙看看
- 用struts2开发时启动tomcat出错 ,各位老师帮忙看看啊~~谢谢了~·
- 求助各位高手,帮忙做下,谢谢了
- 新手求助,恳请各位大牛帮忙...mapinfo
- 各位帮忙看看 sting前向声明的问题
- 大家帮忙看看 这个js怎么写?
- 求助:求大神帮忙,,,,看看代码有什么问题?
- 帮忙各位
- 求助帮忙
- 帮忙求助
- 刚学算法,程序运行不了,谁帮忙看看
- 违反唯一约束条件怎么解决,求各位大神帮忙
- 帮忙看看
- 帮忙看看。。。。
- 请帮忙~~各位大哥,C#编程 用socket套接字实现文件和文字的传输 怎么编写??????
- 存储过程中怎么获取数据的序号
- java面向对象
- 基于 Android NDK 的学习之旅-----环境搭建
- Lync2013扩展开发
- 集成 Tomcat 插件到 Eclipse 的过程
- 求助各位帮忙看看CreateMutex怎么用OD调不了
- 面试最搭衬衣该咋选尺寸
- java程序应用1 -- 多线程
- java eclipse开发中快捷键
- pspice建立仿真模型元件库
- SELECT INTO和INSERT INTO SELECT两种表复制语句解析
- WinInet编程
- 浅谈PHP 5中垃圾回收算法的演化
- Python中hashlib模块, 快捷加密数据