|
Hello
You can extract it from module file name (GetModuleFileName ).
Andrew
|
|
|
|
|
<br />
char BufferApplicationFile[MAX_PATH] = {0};<br />
if (GetModuleFileName(AfxGetInstanceHandle(), BufferApplicationFile, MAX_PATH) == 0) {<br />
}<br />
|
|
|
|
|
abd.Eskandari wrote: How can i get application path?
TCHAR str[MAX_PATH];
GetModuleFileName(NULL,str,MAX_PATH);
OutputDebugString(str);
TCHAR szFileName[MAX_PATH];
_splitpath(str,NULL,NULL,szFileName,NULL);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
[CODE]http://img301.imageshack.us/img301/5328/closewait0lw.jpg[/CODE]
1. what does "close wait" means?
2. what does "fin_wait2" means?
i understand that these are socket status but
- what do they mean? the socket is waiting for server? the socket is shutting down but waiting for certain event to happen before it's allowed to shutdown?
- what situations causes them?
- it seems that the socket is waiting for something, how can i stop the close wait/fin_wait2 and shutdown the socket? (gracefully or forcefully)
it seems that sockets on "close wait" and "fin_wait2" on my program are the ones with problems
please advise
|
|
|
|
|
Hi
I do have a dialog with a spinner control which is "connected" to an edit box. That edit box is a "number" so the user can not enter any non-digit characters.
Now I click the edit box, enter the number "55555" and then press the up-button of the spinner control. The result (unfortunately) is, that the number is not "55556" but "55.556" (notice the dot in there).
How can I prevent the spinner control from inserting any dots in the number-text?!?
Thanks & Bye,
T.T.H.
P.S.: I coding an MFC v7.1 application with MS Visual Studio.NET 2003 v7.1.3088 on a German WindowsXP - my problem could be caused by the German number convention (e.x. "12.345.678,90") which I do NOT want to be used in any way in my application.
|
|
|
|
|
T.T.H. wrote:
How can I prevent the spinner control from inserting any dots in the number-text?!?
There's a UDS_NOTHOUSANDS style that you can use for that. In the dialog properties editor, it shows as "No Thousands".
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Check the properties of the control (within the resource editor).
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Thank you so much guys!
Sometimes I just need a nudge in the right direction
|
|
|
|
|
|
Hi there,
I'm trying to use a CImage in order to display some images in a window. I can easily load an image with Load() method, but what I want now is to create a (w x h) image (easy) and fill it with a color. How can I do this? I tried to use the following:
<br />
for (int x=0; x < width; ++x)<br />
for (int y=0; y < height; ++y)<br />
img.SetPixel(x,y,RGB(...));<br />
But of course, as I expected, it takes quite a few seconds to fill the image. Is there any faster way?
Thanks,
Themis
|
|
|
|
|
Can you get the HBITMAP of the image and put it in a HDC ? Then you can fill it all in one go.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
What's the best solution for representing real time data in a column/bar chart?
I need to represent data (the speed of different instruments) that is updated every second. I'd prefer to display each speed in different columns and using 2 areas/colours for each one: 1st area/colour for the speed within the limits and a second area/colour when the speed is over limits but mantaining the first colour since the limit.
What's the best way to do that? AFAIK I can do it using MS Chart but I found it a bit limited. What about Dundas Chart? Any other solution to use with VC++6, MFC42?
Thanks in advance,
Marc Soleda
|
|
|
|
|
Hello All,
There is a basic doubt in multi threading. I want to allocate memory in one thread and i want to use that memory in other thread and free in that thread.
Threoritically memory allocated in one thread using malloc / new function can not be freed using free / delete in other thread. It it correct?
The code I have given below
Language VC++ 6.0
OS: Windows 2000
typedef struct CapturedData {<br />
long m_lLength;<br />
char *m_pData;<br />
}NewCapturedData;<br />
<br />
CTypedPtrList <CPtrList, NewCapturedData*> g_oCapDataList;<br />
<br />
LRESULT OnCaptureAddData (WPARAM wParam, LPARAM lParam) <br />
{<br />
NewCapturedData *l_pCapData;<br />
<br />
l_pCapData = new NewCapturedData;<br />
l_pCapData->m_lLength = (long) lParam;<br />
l_pCapData->m_pData = (char*) calloc (sizeof (char), (long)lParam);<br />
if (!l_pCapData->m_pData) {<br />
return FALSE;<br />
}<br />
memcpy (l_pCapData->m_pData, (char*) wParam, (long)lParam);<br />
EnterCriticalSection (&m_oCapDataCriticalSession);<br />
g_oCapDataList.AddTail (l_pCapData);<br />
LeaveCriticalSection (&m_oCapDataCriticalSession);<br />
PostThreadMessage (WM_CAPTURE_PROCESS_DATA, 0, 0);<br />
return TRUE;<br />
}<br />
<br />
LRESULT OnProcessDataMsg (WPARAM wParam, LPARAM lParam)<br />
{<br />
CapturedData *l_pCapData = g_oCapDataList.GetHead ();<br />
<br />
<br />
free (l_pCapData->m_pData);<br />
l_pCapData->m_pData = NULL;<br />
free (l_pCapData);<br />
l_pCapData = NULL;<br />
}<br />
NOTE: Above code is part of code i have given, but orginal code is compiling and linking and executing.
The project is dealing with packet capturing and it has to take minimum memory and really fast.
Is it better idea to free in the second thread?
If the memory has to be freed in first thread? I am planning to post a message to first thread, to intimate first thread from 2nd thread when ananysis is complated to remove the memory!!!! For this approach i have to add "GetMessage" in First thread and depending on the message free the memory.
Can you please suggest which design is better?
Thanks for your time
Ravi
|
|
|
|
|
Ravi Sankar S wrote:
Threoritically memory allocated in one thread using malloc / new function can not be freed using free / delete in other thread. It it correct?
No, that is not correct.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
....
My application draws a continous graph in a picture box treating it as a bitmap of width 600 pixels...once the area is filled...BitBlt function scrolls the graph towards left in order to continue drawing...problem is that if I try to scroll the graph MORE THAN 40 PIXELS .drawing area is not cleared properly....
what should be done
|
|
|
|
|
Post the code, so we can tell what the problem is.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Raza5680 wrote:
problem is that if I try to scroll the graph MORE THAN 40 PIXELS .drawing area is not cleared properly....
Just a guess:
You need to invalidate the drawing area.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
I want to delete a file,but MFC shows shareviolet error
how can disable this error and delete that file?
|
|
|
|
|
A file's color should have no bearing on whether it can be deleted or not.
A sharing violation indicates that the file is in use by another process. Are you sure you still want to delete it?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
How can i resize a dialog to fullscreen
|
|
|
|
|
int x;
int y;
x = GetSystemMetrics(SM_CXSCREEN);
y = GetSystemMetrics(SM_CYSCREEN);
SetWindowPos(NULL,0,0,x,y,SWP_NOZORDER);
this is this.
|
|
|
|
|
I want to get the workspaces path.GetCommandLine() only displays
the ....\debug\*.exe path.Please how can i get the *.dsw path where
the source files are kept
|
|
|
|
|
use "GetCurrentDirectory"
|
|
|
|
|
Can you tell me the most simplest way to change the CButton's back ground color.
|
|
|
|