|
WuJunyin wrote: A Dialog at client side using a CFileDialog to open a image file. the problem is, after the server side close client side dialog, but the CFileDialog remains on screen.
Such a problem can occur only if the file open dialog is not the child of the Dialog. This may happen if you are showing the dialog from a separate thread. try setting the m_ofn.hwndOwner of the CFileDialog with the handle of your dialog.
CFileDialog dlg(1);<br />
dlg.m_ofn.hwndOwner = m_hWnd;
dlg.DoModal()
Its only a guess. just try.
|
|
|
|
|
Thanks for your reply.
It's doesn't work.
-- WuJunyin
|
|
|
|
|
Hello all,
I am being driven crazy by the following stupid run-time error, and I would appreciate very much if someone could help me resolve it. Particulatly, I have the following code:
1: CMimeMessage msg;
2: msg.AddRecipient(_T("to@yahoo.com"));
3: msg.SetSender(_T("from@yahoo.com"));
4: msg.SetSubject(_T("Greetings"));
First three lines of code work perfect. But when I try to execute the 4th one, I get a runtime error, and when I click to retry, I am redirected to following piece of code in file: atlspriv.h.
inline BOOL AtlMimeConvertStringW(
__in IMultiLanguage *pMultiLanguage,
__in UINT uiCodePage,
__in LPCWSTR wszIn,
__out_ecount_part_z(*pnLen, *pnLen) LPSTR *ppszOut,
__inout UINT *pnLen) throw()
{
ATLENSURE( pMultiLanguage != NULL );
ATLENSURE( wszIn != NULL );
...
Has anybody any idea what can be wrong here ? The funny thing is that, all methods in previous code require same parameter, i.e. LPCTSTR, so why should one fail, when another doesnt ?
I dont know, I am confused
I would appreciate any hints, or whatever..
PS. I googled and found out that someone, fixed the problem by using ::CoInitialize(NULL) call, but I cant us it, as it is obsolete in VS2005. ( http://www.tech-archive.net/Archive/VC/microsoft.public.vc.atl/2007-02/msg00055.html )
|
|
|
|
|
stack overwrite?
What happens in the debugger?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</A>
|
|
|
|
|
ATLENSURE( pMultiLanguage != NULL ); // THIS ASSERTION IS THE ONE THAT FAILS !!!
|
|
|
|
|
well, that's why I said it might be someone overwriting the stack...
What happens in the debugger?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</A>
|
|
|
|
|
Hi all. My goal here is to copy the currently used file. Then start the new file and delete the old one. An update sequence if you will.
My code:
<br />
#include <iostream><br />
#include <windows.h><br />
using namespace std;<br />
<br />
int main(int argc, char *argv[])<br />
{<br />
char *file="program.exe";<br />
char *currentfile = argv[0];<br />
CopyFile(currentfile, file, FALSE);<br />
<br />
if(file == currentfile){ <br />
Sleep(8000);<br />
DeleteFile(argv[1]);<br />
}<br />
else{<br />
ShellExecute(0,"open", file, argv[0], 0, SW_SHOW);<br />
exit(1);<br />
}<br />
return 0;<br />
}<br />
Im stumped trying to figure this out. Any suggestions will be accepted (as long as their helpful =P). I think its trying to delete itself, which is 'not' what im trying to do. So if anyone can help me figure out what im doing wrong i'd be very greatful. Thanx in advance!
|
|
|
|
|
I can't figure out what you are really trying to do.
First thing I've noticed is that. you are mainly dealing with a hardcoded file name "program.exe" and passed argument value which is in argv[0]. But you are trying to delete a file which is in argv[1]. I doubt you are really intended to deal with that parameter.
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
Sarath. wrote: I can't figure out what you are really trying to do.
"My goal here is to copy the currently used file. Then start the new file and delete the old one."
I've already said that, i _know_ the code is wrong. Im asking for help in trying to fix it.
|
|
|
|
|
Sorry if I misinterpreted your question. Seems someone else already answered your question.
In addition you will have to use strcmp or any other string comparison routine to compare the strings...
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
dellthinker wrote: if(file == currentfile){
this will never be true, these two pointers are always different.
dellthinker wrote: Sleep(8000);
I like those out-of-the-blue numbers. Should I increase or decrease them when switching
to a faster CPU or another Windows version?
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Luc Pattyn wrote: I like those out-of-the-blue numbers. Should I increase or decrease them when switching
to a faster CPU or another Windows version?
5 for that.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->ßRÅhmmÃ<-·´¯`·.
|
|
|
|
|
<br />
char *file="program.exe";<br />
char *currentfile = argv[0];<br />
<br />
if(file == currentfile){ <br />
...<br />
In this case you're comparing to pointers -- not 2 strings. You must use a string comparison function to do it... strcmp?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</A>
|
|
|
|
|
probably want it case-insensitive...
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
I've never had much luck on VC++ 6.0 copying a dialog resource cleanly.
Now I'm trying it with VC++ 2003. I'm trying to copy a dialog from one project to another with the intent of including the .cpp and .h files later on to save me some work but copy/paste does not do anything and drag and drop from one project to the other gives visual indicators during the drag as if it wants to do it, but nothing happens when I attempt the drop.
I'm probably just missing something very important and probably very obvious but I can't seem to get it to work.
Any ideas how to copy a dialog template from one project to the next without needing to dig into the .rc file directly?
|
|
|
|
|
I usually open the 2 RC files in NOTEPAD -- and copy dialogs by hand.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</A>
|
|
|
|
|
So we really are stuck doing it by hand still. Not surprising but very odd for a nth generation "Visual" IDE.
Thanks for the feedback.
Does VC++ 2005 or 2008 handle copying or is it still by hand there as well?
(I never tried that with VC++ 2005 beta when I tested it back then.)
|
|
|
|
|
Hello everyone!
Here are my questions:
1) When drawing ellipses, rectangles, lines, et cetera, how do you select a color? I can't use SetDCPenColor() because they're not supported on Win9x/ME. And I'm on Win3.1.
2) How do you free memory from a HBITMAP?
Thanks in advance!
Windows Calculator told me I will die at 28.
|
|
|
|
|
Lord Kixdemp wrote: 1) When drawing ellipses, rectangles, lines, et cetera, how do you select a color?
Create a pen and a brush. Select them into the DC you're going to draw on.
The pen will be used for the outline, the brush for the interior.
Lord Kixdemp wrote: 2) How do you free memory from a HBITMAP?
DeleteObject()
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I dont know why you got vote 3?
|
|
|
|
|
Doesn't matter to me. If the OP needs more info then (s)he's free to ask.
Explaining all of the basics of GDI (which is well documented) here is kind
of beyond the scope of this forum.
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark replied my question in its entirety, I don't know why someone voted 3... I didn't even know there was a voting system until Hamid said that and I figured it out. o_O
*Is voting... takes some time*
Windows Calculator told me I will die at 28.
|
|
|
|
|
Yeah you can of 1 to 5 give to someone (like 5 to me )
|
|
|
|
|
Do you like, win something with high scores?
Windows Calculator told me I will die at 28.
|
|
|
|
|
For win we need to write a good article and submit it on the codeproject.(I told you because it's first time that you are using of vote so I was thinking you start with 5
Except it I like to ask a question of you whats the meaning of your Signature I saw it already?
|
|
|
|