|
ghunzel06 wrote: // clean up
LocalFree(npszFile);
}
SetWindowText(firstFile);
}
Instead of SetWindowText(firstFile), send a message to parent window,as
CWnd pwndParent = NULL;
pwndParent = GetParent();
if (pwndParent && pwndParent->GetSafeHwnd())
pwndParent->SendMessage(CUSTOM_MSG, WPARAM, LAPARAM);
On handling this message, set the string to the 1st edit control.
Do your Duty and Don't expect the Result Rate this Post, if I helped You
|
|
|
|
|
but how about the reusability of the custom edit control? I dont think I will be able to use it in other dialogs if in case in that dialog I dont want that behaviour.
|
|
|
|
|
ghunzel06 wrote: but how about the reusability of the custom edit control?
What about it? The parent of a control can choose whether or not to handle messages sent by its children.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Modify code like this:
void CLaunchDlg::OnDropFiles(HDROP dropInfo)
{
WORD wNumFilesDropped = DragQueryFile(dropInfo, -1, NULL, 0);
CString firstFile= _T("");
for (WORD x = 0 ; x < wNumFilesDropped; x++)
{
WORD wPathnameSize = DragQueryFile(dropInfo, x, NULL, 0);
WCHAR* npszFile = new(nothrow) WCHAR[wPathnameSize + 1];
if (npszFile == NULL)
{
continue;
}
DragQueryFile(dropInfo, x, npszFile, wPathnameSize + 1);
LPCTSTR pFileName = PathFindFileName(npszFile);
firstFile = pFileName;
delete [] npszFile;
break;
}
SetWindowText(firstFile);
}
Steve
|
|
|
|
|
sorry and thanks for the heads up
|
|
|
|
|
I should be the one saying sorry; I've just re-read your post and realised that I misinterpreted your question. I thought you wanted an edit control then when a file was dropped on just filled in the filename and not the complete path. It seems this was not the case.
Steve
|
|
|
|
|
yeah, getting the filename is not the problem, sorry if it wasn't clear. I got a few solutions now that I can try. thanks for your time.
|
|
|
|
|
Hi all:
Is it possible to user timer before the window has created? It seems I have to provide an valid window handle to SetTimer(...) in order using callback.
Thanks
|
|
|
|
|
If you want to use the callback functionality by passing a non-NULL function pointer to the lpTimerFunc argument then the hWnd argument is not required. Note that you must be running a message pump for your callback to be called; see here[^] for details on this.
Steve
|
|
|
|
|
But in order to use message pump you have to have a window created already, But how can I do that before window created, Or some other ways around without SetTimer?
-- modified at 23:28 Tuesday 27th March, 2007
Sorry, I was wrong the message pump works without creating window.
Thanks for the advise.
|
|
|
|
|
LiYS wrote: But in order to use message pump you have to have a window created already
No, you don't.
Can you explain your problem in more detail?
Steve
|
|
|
|
|
Stephen Hewitt wrote: No, you don't.
Sorry, I was jump to the conclusion, your method works, Thanks again.
|
|
|
|
|
How should I quit from
while (GetMessage(&msg, NULL, 0, 0))<br />
{<br />
TranslateMessage(&msg);<br />
DispatchMessage(&msg);<br />
}<br />
After KillTimer()? Does PostQuitMessage() appropriate?
|
|
|
|
|
Calling PostQuitMessage from the same thread that contains the message loop will do the trick.
Steve
|
|
|
|
|
Dear all,
i have an application where i need to convert a floating-point to double precision using c program. i am not sure how to implement it and was wondering if anybody can help. an example with source code can help. Thanks.
|
|
|
|
|
morocco212 wrote: convert a floating-point to double precision using c program
float x;
double y;
y = x;
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
|
Floating-point to hex and floating-point to double are two different things.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
in my appliction, i have a floating point that i need to convert to double precision so i can transmitted over can bus.
|
|
|
|
|
That's fine. I was just pointing out that the subject of your post differed from its body.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
Hi all,
How can I clear garbage from my buffer char buffer[100]; .
The last element in the buffer contains the following:
For example:
Text DataÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌt
// Most of this string is garbage ...
Many Thanx
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
Put a '\0' character where your string should end.
|
|
|
|
|
|
That is usually what you see in an uninitialized string in the debugger.
You can flush the whole thing by calling ZeroMemory( buffer, sizeof(buffer) ); if you want to.
|
|
|
|