|
I have derived a class from CWnd and added it to a dialog using the custom control 'control' (I feel like Austin Powers)
Anyways...I wanna initialize the damn thing, but I don't know what fricken function to do so in...
PreSubclassWindow doesn't seem to work
I used Chris's Bitmap Viewer Custom Control article as a template so i'm lost as to why the above isn't working...???
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hockey wrote:
PreSubclassWindow doesn't seem to work
It should. Can you put the breakpoint in the function and check if it fires?
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
I figured out the trivial problem...my bad...
Cheers
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
What bitwise operator/combination would I use to force a bit...???
Would the following yield the result im looking for..?
1 & 0 = 1
1 & 1 = 1
Basically I wanna ensure the WS_VISIBLE bit is always set.
dwStyle & WS_VISIBLE would accomplish this yes...???
Thanx
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
dwStyle |= WS_VISIBLE; /ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Thanx
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I believe that you use the (dwStyle & WS_VISIBLE) to test if WS_VISIBLE bit is set in dwStyle, which might help you with what you want.
However a better way to do this is to use the OR operator ( it's the | : shift+\) the OR operation results in true if any of the arguments was true and false if none were true.
ie 1 or 1 = 1
1 or 0 = 1
0 or 1 = 1
0 or 0 = 0
while the AND (&) is only true if both arguments were true.
Since WS_VISIBLE is always true, the | operator with dwStyle and WS_VISIBLE will always force the bit you are interested in to true. The usage should be along the lines of:
dwStyle= dwStyle | WS_VISIBLE;
This will make sure that the flag bit is forced to true while the rest of the bits are unmodified (since WS_VISIBLE has only one bit turned to true).
exp:
dwStyle 1001110101110111
WS_VISIBLE 0000000010000000
Binary OR (|) 1001110111110111
this is called the Binary OR since it compares bits and results in bits, & is Binary AND too. && and || are the logical operators and compare the arguments bit by bit by return only true or false.
Please correct me if I'm wrong, it's been quite a while ...
-<msh>-
Young Basic programmers never die... they just GOSUB and never RETURN.
|
|
|
|
|
Thanx
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
|
Hi.
I am using multithread quite often now in my program when appropriate. According to Jeff Prosise, there are two simple ways of using multithreading correctly, especially worker threads.
-----
1: private HANDLE + duplicating thread handle upon instantiation
This solution make use of ::CloseThread(...)
2: private pointer to CWinThread + delete private member
This solution requires setting thread autodelete to FALSE and deleting thread manually.
-----
Right now, I am using solution #2. The reason is I would know the thread is really gone because I delete, not MFC. Nonetheless, I have seen developers use both. Jeffrey Richter uses solution #1 in his book, Programming Applications for Microsoft Windows (Dv-Mps General).
Are there advantages one solution has over the other?
Thanks,
Kuphryn
|
|
|
|
|
A few weeks ago, I posted a message about a wierd while loop that wouldnt exit when the subjected control returned "Connected". OK, problem solved. Just for the curious, the input was being added a few characters at a time, and although the TRACE0 showed the "Connect 300", it was broken up. When I added all the strings together it worked.
On to my next major hassle.
Normally I fight with a problem for a few weeks before trudging all over you nice folks for an answer. This is the case now.
Why, in gods name, would the MSCOMM32 control stop receiving data? Here's the ugly details. My app calls a function "Connect" that connects the modem to a remote host. When the function showes connected, it returns. Another function is then called to handle the send / receive of data through the port. Its here that things get all bunged up. I can send data. PortMon (http://www.sysinternals.com[^]) shows the sent data going through the port. But, nothing comes back!
When I connect using HyperTerminal. All works normally. What in the hell could I be doing wrong here?
Thanks for any help, and sorry about the long explaination.
Frank
|
|
|
|
|
Hi,
I wrote a multi-threaded application that sends/recieves documents on a scheduled/event driven basis. It works fine as a console application the files are being sent and the CPU usage is around 30%. My problem is when I have the exact same code in a Windows Service application. When the service is using one thread to send documents it also works fine, but if there is more than one thread running at one time the CPU usage shoots up to 100%. Could someone please help me?
Thanks
P.S. The applcation is also using the System.Timer and File System Watcher.
Thanks Again,
Aisha
|
|
|
|
|
If you're doing a loop you might want to add a Sleep(50) in there to give other tasks a chance.
Todd Smith
|
|
|
|
|
HEllo, I am want to add some images to the Outlook 2000 using VC++, So that I can inbsert some of them to the emails that I will write. I am a new VC++ programmer.
Please help me tohow to code this and give me suggestions.
Thanks
|
|
|
|
|
where do i validate the dialogs data? Is it in the views member function?
pl give me an idea.
Thanks
dana
|
|
|
|
|
i usually override OnOK in the dialog and do any validation there. if the validation fails, tell the user what happened and then return, don't call CDialog::OnOK.
-c
WWJD? JWRTFM. found on /.
|
|
|
|
|
Ok, I can override the OnOk function to do my validation, but how to i make the users data to be transferred to the dialog's member variable? do i have to call the DoDataExchange function??
|
|
|
|
|
in OnOK, call UpdateData, first. this will send all the data through the DDX functions and into whatever variables you've attached to the controls. then you can look at the member variables and do your other validation.
-c
WWJD? JWRTFM. found on /.
|
|
|
|
|
Validate how ? If you're using DDE, then the data validates itself at the time of entry.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
it is for validating the string entented in the textbox? to my knowledge, i think we can validate only the max. length of the string in DDX functions?
am i correct or not?
|
|
|
|
|
Yes. DDX sucks in any case, you should probably follow Chris' advice and validate in OnOK.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
I have implemented global variables with the method that is going round this message board. That is to write a header file with all my global variables and a corresponding .cpp file to call it.
global.h
namespace myspace{
extern int myvar,*myptr;
}
global.cpp
int myspace::myvar,*myspace::myptr;
This work perfectly;), but I need my pointer to be initialize with new() statement for the first use. I would like to put it in the global.cpp file so that this is done automatically when this global file is being used. How do I do that?
Could I do it using Class ?? If the new() statement is implemented in the constructor, would this means every class derive from this Base Class, would call new() statement in the constructor? This means redudant memory allocation is done here?
|
|
|
|
|
There is no class here, only a namespace. You just said they were globals, didn't you ? You can call new in the .cpp file. You could also assign to NULL, and have your classes call new if NULL.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
Thanks for the reply.
I will try it out.
Thanks a million!
|
|
|
|
|
do your "new" in your CWinApp's InitInstance.
-c
WWJD? JWRTFM. found on /.
|
|
|
|