|
First of all, if i were you i'd use a different name for the mutex because "GlobalMainMutex" doesn't seem to be that unique as it should, maybe use a GUID generator and use the generated code as name, or as part of the name of your mutex.
To show the already running instance you could either broadcast a registered message when your new instance detects another instance running upon which your program brings up its window, this sounds a tiny bit overkill (post/send a message to EVERY running app in the system) but it is easy to do, or you could try to find your own process by enumerating processes and checking their names or executable names or whatever and posting a thread message to it, or you could enumerate windows on the system and if you find the one belonging to your process (for example by class name) post a message to it.
p.s: to avoid confusement, i don't mean use a GUID generator to generate a new name every time your app starts, since that would -of course- make the whole idea useless...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
please can u explain me with any example. i m very thankful to u.
thanks.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Well, i currently have no time to write you a complete example proggie but i can try to give you a "skeleton", i hope it will help you somewhat
UINT WM_ACTIVATE_MY_APPLICATION = RegisterWindowMessage("WM_ACTIVATE_MY_APPLICATION_315FrYu76A");
...
if (there_is_another_instrance_running)
{
BroadcastSystemMessage(BSF_POSTMESSAGE, BSM_APPLICATIONS, WM_ACTIVATE_MY_APPLICATION, 0, 0);
exit(0);
}
...
BEGIN_MESSAGE_MAP(CMyVeryOwnApp, CWinApp)
...
ON_THREAD_MESSAGE(WM_ACTIVATE_MY_APPLICATION, OnActivateMyVeryOwnApp)
...
END_MESSAGE_MAP()
...
LRESULT CMyVeryOwnApp::OnActivateMyVeryOwnApp(WPARAM wParam, LPARAM lParam)
{
...
ShowMyVeryOwnMainWindowAndBringToFront();
...
} I hope this helps somewhat...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
this error comes
error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CDataDoctorsEmployeePlannerApp::* )(WPARAM,LPARAM)' to 'void (__thiscall CWinThread::* )(WPARAM,LPARAM)'
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
And you really have no idea what this could mean? Change the LRESULT to void in the method's declaration and definition.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Code-o-mat wrote: ShowMyVeryOwnMainWindowAndBringToFront();
What is in this function.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Code to make your window visible using ShowWindow[^], bring it to front using BringWindowToTop[^], and whatever else you like...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Its need handle of window.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
I don't see why you need that but it is called m_hWnd, a member of CWnd which is among the superclasses of your main window.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Thanks
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Hello,
I have an application that sends SMS to several clients, one by one. I am using EDGE modem and AT commands for this purpose.
My problem is that the application sometimes (not always) fails to send few SMSs (some of my clients complain that they didn't get any SMS). Can anyone tell me why this happens? Or, how can I read the SMS sent-status?
Thanks
|
|
|
|
|
Using VC6++, I created a little dialog based test application with the app wizard.
I have a tab control which shows several tabs. Swapping between the individual tabs works fine.
The content of the tabs consists of dialogs which I have derived from CDialog - hence they have an ESC /CANCEL and OK/ENTER message handler attached.
My problem is that when the focus sits on any of the tabs (i.e. I can see the chid dialog that the tab displays, then when hitting ESC or ENTER, this content of the child window disappears, because obviously the CDialog OnOK() and OnESC() member functions get called.
My beginners knowledge doesn't allow me to dive a bit deeper into the code to override the corresponding member functions (which I think are onOK() ...etc. is that correct?
Could someone explain (and ideally post some lines of code for a beginner), what needs to be done?
Many thanks.
|
|
|
|
|
|
Dear Cédric,
Many thanks for your prompt and efficient help.
As you can see I am new to all this, but now that I know about the FAQ section, I will check that first.
Many thanks again. Problem solved.
|
|
|
|
|
Its good site for you,you can find new things about MFC/C++.http://www.functionx.com/[^]
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hello
Suppose a directx based game(like nfs) is running. I want to grab the buffer which is shown in desktop(all frame). Actually the scenerio is like that: Game's Front buffer will capture by my application then modify this buffer(like my own text will add) and finally display my own buffer data as a game.
Does anybody have some ideas how to do this? If any ideas please let me know.
Regards
Kallol Kumar
|
|
|
|
|
My first guess would be to try to hook some DirectX api calls and modify parameters or store them for your own usage so you can get access to that surface.
p.s: What are you working on, why do you need to access other game's DirectX surfaces, if i may ask?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
modified on Thursday, March 5, 2009 4:53 AM
|
|
|
|
|
Thanks for your valuable reply. Actually I thought hooking may be a solution. But I have never implemented this. Thats why I need to comfirm and need clarification about any other idea.
Anyway, now I am working with "3D Vision". My company website is www.vmclbd.com. We have provided this technology for a japanese company named Digital Amuse(http://www.dams.co.jp/). You can also find our 3D vision related video in youtube (http://www.youtube.com/watch?v=gjZxqPYLcp4). Actually at this moment only our own contents will convert 3D view. Our next goal to convert game or other 3rd party content to make 3D visualization.
Anyway Have you worked with hooking? Thanks again for your help.
Kallol Kumar
kallol.kumar@hotmail.com
|
|
|
|
|
Well, i did hook a few simple methods here and there once or twice, but nothing too serious. I'd recommend checking out this[^] valuable article, it is a good place to start learning about hooking methods. If i understand correctly then you are trying to catch the backsurface before it gets presented to the user...if so, i would try looking into IDirect3DDevice9::Present[^] and see if i can hook anything there...you could also try to hook the methods which query for the device-interface and provide your own version (of interface implementation) which sits between the software and the original device interface as a proxy and does its workings when needed...these are just ideas...
This seems to be an interesting task you are doing.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Hi,
I made HTML Help for every topics of my applicaiton.
I want to get help form all dialog,but it refersa single help file,but depends on dialog it shows the topic..So i coded for that.
My coding is here
BOOL CDisturbance::OnHelpInfo(HELPINFO* pHelpInfo)
{
HWND hwnd = GetSafeHwnd();
CString Path = gsInstallPath + "\\esim\\help" + "\\";
CString HFName = "IStation.chm";
CString Folder= Path + HFName;
HtmlHelp(0, Folder, HH_DISPLAY_TOPIC, ByVal "Disturbance.htm");
return TRUE;
}
I found this code from net as article,
But when i compile,it shows undeclared identifier for Htmlhelp.
SO tht i include
#include <htmlhelp> and i add htmlhelp.lib in project settings.
But where can i get htmlhelp.h file?
Anu
|
|
|
|
|
Did you see MSDN "CWnd::HtmlHelp" and its header is "afxwin.h" whats your compiler?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Anu_Bala wrote: But where can i get htmlhelp.h file?
See here Html help[^].
You need to install the heml help workshop and add the include and lib paths to your VC++ directories.
I hope it helps.
Regards,
Sandip.
|
|
|
|
|
Thank u..I got the file.
Anu
|
|
|
|
|
But i couldnot get the particular topic..
Pls any one help me the sample coding for htmlhelp API.
Anu
|
|
|
|
|
Anu_Bala wrote: Pls any one help me the sample coding for htmlhelp API
See here[^]
I hope it helps.
Regards,
Sandip.
|
|
|
|