|
don't confuse strlen() and sizeof
|
|
|
|
|
You've allocated memory for your string but you haven't put anything inside it. It's just coincidence that your cout is printing 4.
You also need to do this:
varstr[0] = '\0' ;
BTW, you've only allocated enough space for 1 character and given that strings always need at least one character for the terminating '\0', your string is always going to be empty
0 bottles of beer on the wall, 0 bottles of beer, you take 1 down, pass it around, 4294967295 bottles of beer on the wall.
Awasu 2.2 [^]: A free RSS/Atom feed reader with support for Code Project.
|
|
|
|
|
thank you Taka Muraoka it's works fine
thank you everybody 
|
|
|
|
|
Hi All,
I have a non mfc dll(does not contain the CWinApp) which needs to talk to 2nd dll which uses mfc as a shared dll.I want to make a call to the 2nd dll from the 1st one inorder to display a dialog box. I'm using LoadLibrary to load the 2nd dll from the 1st one and using GetProcAddress to get the address of the function which creates an object of dialog box and calls DoModal on it.But when I make a call in this manner, the code is crashing at ASSERT((p = pMap->LookupPermanent(m_hWnd)) != NULL ||
(p = pMap->LookupTemporary(m_hWnd)) != NULL); in Wincore.cpp
Can anyone please tell me what the problem is.
Thanks in advance
Raghu
|
|
|
|
|
have u called
AFX_MANAGE_STATE(AfxGetStaticModuleState());
in the first line of the function which creates the dialog?
nave
|
|
|
|
|
|
Ensure u have called
AfxEnableControlContainer();
Enable3dControls();
nave
|
|
|
|
|
from where should these functions be called
|
|
|
|
|
i think u can do it from dll attach of the extension dll
nave
|
|
|
|
|
I have in my project a CHyperlinkStatic class and I don't known who wrote it. Did anybody known something about?
|
|
|
|
|
|
Given that it has Static in its name, I bet whoever wrote it does not have a correct understanding of how GUI controls work on Windows...! :P
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Why do you say that?
Steve
|
|
|
|
|
Stephen Hewitt wrote: Why do you say that?
Experience.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
|
Hi All
I want to implement wildcard characters in comboBoxs where the columns of databases is listed like EmpI* (which may be EmpID or anything after EmpI).
how will I able to accept * with column name and how will I search or sort according to given option like EmpI*.
Please give the proper steps to do this or the test application code.
Love
Mausam
mausam
|
|
|
|
|
If you want to query a MySQL database using wildchars have a look on LIKE operator: String Comparison Functions[^] It might go for other databases. Good luck!
|
|
|
|
|
Hi all,
How can my application or process know that the user is going to End Process ( or End Process Tree ) it, with task manager?
I am using Windows XP.
Thank you.
- NS -
|
|
|
|
|
Put simply, you cant... Task Manager calls TerminateProcess[^] which stops the process dead and doesn't allow it execute anymore code.
End Process is designed to be a last resort for processes which have stopped responsing.
Gavin Taylor
w: http://www.gavspace.com
|
|
|
|
|
Yes, I understood...
Thank you...
- NS -
|
|
|
|
|
Almost but not quite true. If you select the "End Task" button from the "Applications" tab then task manager attempts to close the application gracefully by sending the window a WM_CLOSE message and only resorts to terminating it if it doesn't die within a timeout. If the "End Process" button is selected from the "Process" tab the process is terminated on the spot (as you describe). Actually things are actually slightly more complicated then described above but this gives the general idea.
Steve
|
|
|
|
|
Perhaps you can hook the TerminateProcess function in the kernel dll, then whenever it is called, check to see if the process to end is your process then return immediatly and don't call the hooked function.
Hooking can be a tricky thing to accomplish actually, I've had some experience with it using Microsoft's Detours library, it took sometime but proved to be useful at last, maybe you can try and see what turns out for yourself
--
Wessam Fathi
|
|
|
|
|
That may be a cruel thing...
Actually I was seeking for a simple method if any...
Anyway thank you very much for your support...
- NS -
|
|
|
|
|
Patching TerminateProcess in one process will not effect other processes.
Steve
|
|
|
|
|
Did you check out the detours library, Detours intercepts Win32 functions by re-writing target function images.
I used it when developing a simple firewall, to re-route all calls to winsock functions (connect, listen, send, recv). It is a system wide hook where all calls to the patched functions from all processes are redirected to my detour function.
--
Wessam Fathi
|
|
|
|