|
This gets weirder and weirder.
I created a new solution (workspace). Copy&pasted the code into a new .cpp file, compile and executed and all worked just fine.
Can we say, "things that make you go hmmm?"
Thanks for all the suggestions and help.
Best,
Jerry
The only way of discovering the limits of the possible is to venture a little past them into the impossible.--Arthur C. Clark Toasty0.com
|
|
|
|
|
TranslateMessage() and DispatchMessage() are never getting called. Why? Because your while loop does nothing thanks to the common error of an extra semicolon.
Your message pump is effectively:
while (GetMessage(&msg, NULL, 0, 0))
;
|
|
|
|
|
I have a atl com service that need to do something on windows log off and lock event.
I created a winlogon dll to sendmessage to service for the above events.
STA Service is not getting those messages.
How to detect logoff and lock event from atl COM Service
Chak
|
|
|
|
|
Hi Chak.
> How to detect logoff and lock event from atl COM Service
It's easy with logoff - simply call SetConsoleCtrlHandler and catch the CTRL_LOGOFF_EVENT .
Lock events are trickier. I guess the easiest way to catch them is via a Winlogon Notification Package[^].
Note: Because the notification Dll gets loaded by Winlogon and because Winlogon is running under the local System account (your COM Service probably isn't?), you can't use the SendMessage API as a means of IPC communication between them. Try memory mapped files or named pipes instead. Also, set the Impersonate[^] reg-value of your notification Dll to 1 or modify the Dacl of your memory mapped file/named pipe appropriately (check this: A NotQuiteNullDacl Class[^]).
RK
PS: This were just presumptions from the top of my head -> for the exact behavior/terminology and implementation check the MSDN documentation.
|
|
|
|
|
I am using the CSocket class with all the CSocketFile and CArchive stuff (mainly based on the MFC samples). The problem now is, that, after some time, the socket won't receive anything (well, it receives it, but it still stops at some point).
When receiving the data with CAsyncSocket::Receive, it won't stop, so I guess it's a problem with either CSocket or CArchive/CSocketFile. The funny thing is that the MFC samples have the same problem... and it's not just my computer
So is there any known solution to this or do I have to go a different direction without archives?
And yes, I used IsBufferEmpty()...
|
|
|
|
|
Is there a simple way to emulate console mode on a GUI form or dialog box? Perhaps an article or control somewhere? Would it be logical to create one as a derived Rich Text box?
Sincerely,
Ray Gregory
|
|
|
|
|
All a console is (as far as look) is a window with a fixed width font.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I think it would be probably easier to write your own control for it. If you use the rich text box, you'll be spending lots of code to restrict it rather than extending it. After all, a rich text edit box is text editing control, while a "console" is a line-editing tool combined with static output.
--
Sancte Míchael Archángele, defénde nos in proélio contra nequítiam et
insídias diáboli esto præsídium. Imperet illi Deus, súpplices deprecámur:
tuque, princeps milítiæ cæléstis, Sátanam aliósque spíritus malígnos, qui
ad perditiónem animárum pervagántur in mundo, divína virtúte,
In inférnum detrude. Amen.
|
|
|
|
|
Hi,
I wrote a c++ dll containing a CWnd, which is created an displayed when the dll is loaded by an application. When I use the dll with a c++ app or a VB app everything works fine, window is created and displayed as planned, but when i load the dll from a java application the window seems not to be created correctly.
Any ideas what might be the problem?
|
|
|
|
|
Hi,
i recommand to use statically linked regular DLL.If you choose statically linked DLL it includes copy all the needed MFC library code with in your DLL. So, it size is more. If you choose dynamic linked library the memory space is less compare then static linked library regular DLL. But, you will use proper DLL version in the target machine.
Regards,
R.Selvam
|
|
|
|
|
As you will all surely know C# has this cool interface where you can
put XML into the comment blocks of your code, and have it automatically
generated as a web page of comments (especially using a tool like NDoc.)
This gives you a nice class documentation web page heirarchy.
I have a bunch of code that uses DOxygen style coding for inserting
similar stuff into my C++ code, however, I want to use the same techinques
in C++ that I do in C#. Specifically, I want to be able to type in the
comments directly when I use the class view to insert code, and I want
to be able to use NDoc to generate the pages.
I know about DOxygen, in fact I use it, however, I want to get on the
same page as C# with my C++ code for consistency and simplicity (and
by way of the fact that surely future versions of Visual Studio will
head that direction.)
I suppose I want to use NDoc with C++.
any thoughts or suggestions.
|
|
|
|
|
How can I set the tab focus to a specific control in a dialog box.
Thanks
|
|
|
|
|
SetFocus() .
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
In your dialog class, where you want to set the focus to a control, try this:
GetDlgItem( ID_OF_CONTROL )->SetFocus();
|
|
|
|
|
I'm trying to implement the ability to drag and drop a file onto a tree control, BUT it would be great if you could only drag onto certain objects. Is there a way to allow the user to drag a file onto the tree control and depending on what type of object the user drags the file over, drag and drop is allowed or disallowed?
It would be flimsy for them to have to select a tree item then drag and drop, much nicer if you simply drag the file to the object you want to add it to and if its allowed, it works!
|
|
|
|
|
When your IDropTarget::DragOver() method is called, you get a POINTL holding the cursor location. Convert that from screen coords to client coords (relative to the tree) then use TVM_HITTEST to find out which tree item that point is over.
Once you get that, you can decide whether to allow the drop over that item. Return DROPEFFECT_NONE to not allow it, or DROPEFFECT_MOVE /COPY to allow it.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
"Just because the box has 2 gigabytes of memory doesn't mean you get to use it all!"
-- Rico Mariani, CLR perf guy
|
|
|
|
|
That's awesome thanks.
|
|
|
|
|
Hello,
I am trying to create a new dialog with a text box that accepts string values from my main dialog's program. In other words, once a button is pushed on my main dialog, a new dialog appears with a text box - i would like to send strings from my main dialog program to the new dialog's text box. I am using CCancelBox dlg; and dlg.DoModal(); to bring up my new dialog once the button is pushed, but I don’t know how to link the text box to my main dialog .cpp program. Thanks a million in advance.
~Loren.
|
|
|
|
|
The second dialog will need a member variable that the main dialog sets. Then in the second dialog's OnInitDialog() method, set the control's value to that of the member variable.
CmainDlg::Foo()
{
C2ndDialog dlg;
dlg.m_somevar = "Text!";
dlg.DoModal();
}
C2ndDialog::OnInitDialog()
{
CDialog::OnInitDialog();
m_control.SetWindowText(m_somevar);
}
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
i have met some problems when i try to write the matlab c++ programming.
after i finished my program and tried to compile in MSVC++ 6.0
.......
LINK : fatal error LNK1104: cannot open file "msvcirt.dll"
what should i do to settle this linking problem?
thank you for ur all helping
vincent sim
|
|
|
|
|
Vincent Sim wrote:
what should i do to settle this linking problem?
Check to ensure the file exists and that it is accessible by the linker.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
The problem that I am having is with regards to compiling the RTF files after I have made changes to them.
All I did was open the AfxCore.rtf file and replace the <<YourApp>> callouts with MyApps Name.
I used Microsoft Word 97 and saved the files back as RTF.
I then opened up Help Workshop and compiled the files.
I got numerous errors and the HLP file was not created.
Anyone else have this problem?
|
|
|
|
|
Personally, I have always avoided using Word etc to edit the .rtf files. You will find that editing them in a tool such as notepad or Visual studio (as text) will allow you much better control.
Also this article may be of help if you do follow this route: Simplified AfxCore and AfxPrint.rtf files[^]
Roger Allen - Sonork 100.10016
If your dead and reading this, then you have no life!
|
|
|
|
|
I have a function that looks like
Process(string str1 , string str2)<br />
{<br />
string concat ;<br />
concat = str1+":"+str2;<br />
ProcessFurther(concat);<br />
}
str1 and str2 passed are strings but represent numbers. Is there a way i can do a type checking to find if its a valid number .
I am looking for something like isNumber() functionality as i need to make sure that what is passed is surely a valid integer and not a garbage string which might have catastrophic results !
Please advise
|
|
|
|
|
you could use strtol() to convert the string to an integer, and then make sure the endptr actually points to the end of the string.
bool IsNumber(std::string str, int base)
{
char *EndPtr = NULL;
const char *Number = str.c_str();
strtol(Number, &EndPtr, base);
return (EndPtr != Number && *EndPtr == NULL);
}
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|