|
Once you have the path of the running application, you can use _splitpath() and related functions.
|
|
|
|
|
wow, a function like this does exist there. What I did is:
TCHAR szBuff[_MAX_PATH];
::GetModuleFileName(AfxGetInstanceHandle(), szBuff, _MAX_PATH);
char ch = '\\';
char * pdest = strrchr(szBuff, ch);
to extract the application name from its full path.
|
|
|
|
|
or, you could use _splitpath.
-c
Cheap Oil. It's worth it!
|
|
|
|
|
oh, yeah, I think I'd better use it since it is more robust.
|
|
|
|
|
try
extern char ** __argv;
and then use __argv[0];
|
|
|
|
|
"As one microcosmic example, take a look at IEnumerable and how it enables you to provide enumeration capabilities for any class!"
Can anyone tell me what enumeration capabilities are? I often see classes with Enum in them...
|
|
|
|
|
Hi all,
I would like to know what is Microsoft Visual C++ .NET standard?
Is it new version of Microsoft development studio?
If so what is new with this or what I can do more?
Can I compile application built with VC++ 6.0 if I install MS VC++ .NET standard?
thanks
regards
/rsasalm
|
|
|
|
|
Anonymous wrote:
Is it new version of Microsoft development studio?
Yes.
Anonymous wrote:
If so what is new with this or what I can do more?
Many classes added in addition to revious classes. Also new language named C# is availabe too.This language completely based on .NET framework.
Anonymous wrote:
Can I compile application built with VC++ 6.0 if I install MS VC++ .NET standard?
I think in most case yes but not all of them.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Mazdak wrote:
think in most case yes but not all of them.
huh?
Why should it be impossible to compile some VC++6 projects in VC++.NET??
noo... thats not true... but if you compile VC++.NET projects in VC++6 you can get problems because there is some difference between MFC7 and that MFC that VC++6 has (MFC4 or what it is)!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C# and C++!
|
|
|
|
|
Rickard Andersson wrote:
Why should it be impossible to compile some VC++6 projects in VC++.NET??
Rickard,I heard it here lots of time and sombody gave me some links about it too.But I can't remember it now to tell it to you.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
How could I put the PC into sleep mode from my application? Is there an API for this power management stuff.
|
|
|
|
|
SetSystemPowerState might be what you're looking for.
|
|
|
|
|
Hello,
Does MFC provide us with a check list control.
If not, how can I do it?
I need to build multi columns list with a check box at the left.
Thanks,
With Best Regards,
Rula Ghabbiesh.
|
|
|
|
|
if u mean the Kist box related stuff
just change the list control in to the Report view and set the extended style Like
yourcontrol.SetExtendedStyle(yourcontrol.GetExtendedStyle()|LVS_EX_CHECKBOXES );
R_Renjith The True CP ian
|
|
|
|
|
I want to write data on a socket. Let suppose that just before i write data, some data arrives at the same socket to get read. Now under this condition, can i write on that socket OR I've to again check that no data available at that socket for read ???????
|
|
|
|
|
bakhtawar wrote:
Let suppose that just before i write data, some data arrives at the same socket to get read. Now under this condition, can i write on that socket
Yes , you can! Internally there are two buffers, one for reading and one for writing.
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
Hi everybody,
I'm using a function taken from a DLL.
It can be a lengthy wait for it to finish so I want to create a stop button to stop the function if the function begins to take too long. As the function is in the dll, I don't know how to stop the function.
Could anyone help me in teaching me how to do this? Thanks!
wilche
|
|
|
|
|
You can load and excecute that function in a seperate thread
and when u want to stop just terminate that thread...
i think that work perfect..!!
R_Renjith The True CP ian
|
|
|
|
|
Thanks for your reply. Not disputing what you said but I have some questions....
If I used worker thread, for example the following code:
//ThreadProc is the procedure used by worker thread
int ThreadProc()
{
// event declarations and def
event[0] = ::CreateEvent(NULL, TRUE, FALSE, NULL) // Stop/abort
event[1] = ::CreateEvent(NULL, TRUE, FALSE, NULL) // Run
DWORD status;
while(TRUE)
{
status = WaitForMultipleObjects(2, event, FALSE, infinite);
switch(status)
{
case WAIT_OBJECT_0: // Abort
CloseHandle(ThreadId);
return result;
case WAIT_OBJECT_0+1:
result = RunFunction();
break;
}
}
return result;
}
In this case, wouldn't it still wait for RunFunction to finish before processing the Abort Event?
If I create an UI thread using message queue, I do something similar using GetMessage say.
int ThreadProc()
{
DWORD status;
while(TRUE)
{
status = GetMessage(&msg, NULL, 0, 0);
// Check that the message is valid...code ignored here. Assume it's ok
switch(msg.message)
{
case abort: // Abort
CloseHandle(ThreadId);
return result;
case run:
result = RunFunction();
break;
}
}
return result;
}
Would I still have the same problem? In this case, RunFunction will have to be completed before the next message will be processed.
Kind regards,
wilche
|
|
|
|
|
I want to create two threads. One thread should write to the CLidt object and the other thread should read from the CList object.And i want to use Mutex as the synchronization object, so that only one thread can access the CList object at a time.
Pls. help
Rsh
|
|
|
|
|
Actually a critical section is a better sync object for your purposes, and easier to use. Each thread calls EnterCriticalSection() before accessing the list, then LeaveCriticalSection() once it's done with the list.
--Mike--
Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Just out of interest, why is critical section better in this case? Wouldn't mutex serve the same purpose?
Regards,
wilche
|
|
|
|
|
A critical section is more lightweight than a mutex. A mutex differs from a critical section in it can be accessed across process boundaries and you can specify a timeout when waiting on it. Neither of these are needed in his situation so might as well use a critical section.
|
|
|
|
|
The technical reason is that a critical section doesn't require a switch to kernel mode unless a second thread is trying to lock it when another already has the lock. A mutex will always cause a kernel mode switch.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Hi,
What is the best method for deleting all files and
folders from a floppy (programatically)
Sameer
|
|
|
|