|
I'm linking unicows to my app to have a single unicode exe that also runs on Win9x.
Everything works fine but if the unicows.dll is not present the app crashes at startup.
I would like to avoid this and give the user a message that he needs the dll.
|
|
|
|
|
If you linked unicows.dll implicitly (using an import library), then you can't detect that the DLL is not present yourself. The Windows loader is looking for it at startup.
You can correct this in one of two ways.
First, you can set a linker option to delay load unicows.dll . When you do this, the DLL isn't loaded until the first call to it. You can then check in your startup logic, before the first unicows call, and issue an error message. Look in the MSDN for /DELAYLOAD .
Secondly, you can use the LoadLibrary() and GetProcAddress() mechanism to explicitly load the library.
Software Zen: delete this;
|
|
|
|
|
Unicows already uses delay-loading (not really delay-loading but a similar technology) and only loads the DLL on Win9x systems.
Also if the Windows loader can't find a DLL the user gets a message box and the app doesn't crash.
Seems like I have to override the unicows loader because otherwise MFC initialization crashes.
|
|
|
|
|
Hi Friends
How to get Serial No of computer processor in Visual C/C++
Thanx in advance
KK
|
|
|
|
|
|
That only owrks on the PIII.
I fell victim to trying that a couple of years ago. Don't waste your time with it. Intel pulled that capability after a massive uproar. Try it on a P4 and you'll see what I mean.
WMI will give you other hardware information like Motherboard serial, Bios serial, etc...
|
|
|
|
|
|
|
Hi
thanx for your information
Regards
KK
|
|
|
|
|
Hello all.
I am currently working on an application which requires to add new fonts in Fonts folder in Windows directory. I am copying the new fonts in the Fonts folder programatically. According to my knowledge I need to open and then close the Fonts folder to Register the newly added fonts with OS.
To register these fonts I am opening the Fonts folder from my application by using following code snippet
STARTUPINFO si;
PROCESS_INFORMATION pi;
LPTSTR szCmdline=_tcsdup(TEXT("C:\\WINDOWS\\explorer.exe c:\\windows\\fonts"));
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
// Start the child process.
if(!CreateProcess( NULL,szCmdline,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi ))
{
printf( "CreateProcess failed (%d).\n", GetLastError() );
return;
}
I just have to wait for say 2 secons after opening the Fonts folder to register new fonts. So after opening the folder I am using following code to wait for 2 secs and close the child process and thus the Fonts foloder that I have opened through that child process.
HANDLE handle = pi.hProcess;
Sleep(2000);
int i = ::TerminateProcess(handle,0);
if (0 == i)
{
DWORD err = GetLastError();
}
While debugging I found that the TerminateProcess() function fails and GetLastError() returns value 5.
Is there something that I am not doing properly?
Why the TerminateProcess() is failing?
Please guide me.
Rakesh
|
|
|
|
|
error 5 is "access denied"
Has the process already terminated by itself?
Suggestion:
Try adding GetExitCodeProcess() to the code before TerminateProcess() to check
cheers,
Neil
|
|
|
|
|
check this
<br />
CWnd *pWnd=FindWindow(0,"Fonts");<br />
pWnd->PostMessage(WM_CLOSE);<br />
whitesky
|
|
|
|
|
Thankyou very much....
Such a nice and effective way you have suggested.
It worked as per my requirement..
Thanks again.
Rakesh
|
|
|
|
|
Hey but there is one issue.
If I change the settings from Control pannel
1. Not to Display the full path in title bar
2. To Display the full path in title bar
then the proposed solution doesn't work properly. I need to change the Text from
FindWindow(0,"C:\\Windows\\Fonts)
to
FindWindow(0,"Fonts")
Is there any solution for this ? Please help.
Thanks
Rakesh
|
|
|
|
|
You need to title from window for get one handle to window or CWnd now whats problem
whitesky
|
|
|
|
|
How We Add Popup to listbox Items .when we right click on any listbox item we should get a popup. i tried this but i am unable to get popups in listbox.
please tell me, urgent.
thank you.
vsn
|
|
|
|
|
I gave you a link yesterday. What is the problem with that?
See Here[^]
Oh! I misunderstood it for a tooltip
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
-- modified at 5:44 Saturday 1st July, 2006
|
|
|
|
|
no man i need popup to the listbox items
vsn
|
|
|
|
|
Derive a class from CListBox(CMyList)and override the OnContextMenu function.
Create a menu in the resource editor as ID_POPUP
Add items and add handlers to those menu items.
IN the OnContextMenu Add the following lines of code
CMenu* myMenu=new CMenu();
myMenu->LoadMenu( ID_POPUP );
myMenu->TrackPopupMenu( TPM_LEFTALIGN|TPM_RIGHTBUTTON,point.x,point.y,this );
When you declare the variable for CListBox change it to CMyList and add the header file (MyList.h where you declare the variable in the header file)
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
-- modified at 7:35 Saturday 1st July, 2006
|
|
|
|
|
i am getting an error that is setmenuinfo is not a member of menus
vsn
-- modified at 7:34 Saturday 1st July, 2006
|
|
|
|
|
ah. That was a typo mistake(Forgot to delete it). I have deleted the line in my post. You can anyhow do without it for now. For your general information menuinfo was of type MENUINFO
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
override the OnContextMenu function.?
i worte all the code u have given in Myclist::ContextMenu.
but where we notice to call this context menu.
vsn
|
|
|
|
|
You don't need to call the OnContextMenu function.
It is called by the framework when the user has clicked the right mouse button (right clicked) in the window.(from MSDN)
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
Cross check that you have inherited a class from list box and then overridden the OnContextMenu function over there.Do not forget to change the type of the variable to CMyList.It works.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|