|
try SetTimer or IsWindow then come back
includeh10
|
|
|
|
|
includeh10 wrote:
try SetTimer or IsWindow then come back
case WM_CREATE:
BOOL b;
b = IsWindow(hWnd);
if(b)
MessageBox(0,"true","true",0);
I put that in my WndProc and I coolly got a mesg box saying true.
The HWND *is* valid when WM_CREATE is sent!!!
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
please use SetTimer then try if the timer is OK, i am using it now, i post the thread because it doesn't work.
there are many cases the HWND can't be used properly on the message.
normally i set timer under WM_PAINT message:
if(bTimer==0)//BOOL bTimer=0 as init
{
SetTimer;
bTimer=1;
}
i don't like the way, i want to find right message.
thx
includeh10
|
|
|
|
|
WM_CREATE is the message you want
LRESULT CALLBACK ViewerWndProc (HWND Wnd, UINT nMsg, WPARAM wp, LPARAM lp)
{
switch (nMsg) {
case WM_CREATE:
SetTimer(Wnd, 1, 500, NULL);
break;
case WM_TIMER:
MessageBeep(1);
break;
...
works great, window pops up and starts beeping away.
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
includeh10 wrote:
please use SetTimer then try if the timer is OK,
I did and it works fine -
case WM_CREATE:
SetTimer(hWnd,100,1000,0);
break;
case WM_TIMER:
FlashWindow(hWnd,true);
break;
I told you several times that WM_CREATE *is* the correct message you are looking for. If your code is not working then the error is somewhere else!!!
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
ok, i post my code, you try it if u like.
//ZView: public CView
LRESULT ZView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{//ZDoc:public CDocument
ZDoc*pDoc=(ZDoc*)GetDocument();
if(pDoc)
{
int i=pDoc->edit.WindowProc(this,message,wParam,lParam);
if(i!=-1) return i;
}
return CView::WindowProc(message, wParam, lParam);
}
//edit is a user class (no parent) for controlling edit input - the interface looks like VC edit enviorment if finish. all messages are transfered to the class.
//edit is instance of XEdit, member of CDocument
int XEdit::WindowProc(CView*pv,UINT m, WPARAM w, LPARAM l)
{
switch(m)
{
case WM_CREATE:
pv->SetTimer(100,500,0);
break;
case WM_TIMER:
P_Timer(pv,w);
break;
.......................
//the edit is used for multi-view, so it is not inside a special CView
void XEdit::P_Timer(CView *pv, WPARAM w)
{
CDC*pDC=pv->GetDC();
// use the pDC paint cursor
pv->ReleaseDC(pDC);
}
it just doesn't work. if from WM_PAINT message, it works fine!
//modified: i know y now
as futher check, pDoc is not OK on WM_CREATE
!!!!!!!!!!!!!!!!!!!!!!!!!!!!
includeh10
|
|
|
|
|
You are an inspiration Nish.
Regardz
Colin J Davies
Sonork ID 100.9197:Colin
You are the intrepid one, always willing to leap into the fray! A serious character flaw, I might add, but entertaining.
Said by Roger Wright about me.
|
|
|
|
|
I need a dll for converting from bmp to jpeg conversion.Anybody knows site for free dll's.
I know the site from intel.
|
|
|
|
|
did you try looking at this site?? there are like 10 different image classes here.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
suresh_sathya wrote:
Anybody knows site for free dll's
Either here on CP, or try the Free Image project at http://www.6ixsoft.com[^] - very handy!
Dylan Kenneally
London, UK
|
|
|
|
|
I am trying to use a PVOID to store a dynamic array of pointers to various objects which will change from time to time so static casts won't work I don't think.
For example I have created a pure virtual base class which all objects SHOULD derive from if they wish to be added to the PVOID memory mentioned above.
Initially I tried using the base class as a cast and paramters for functions.
AddObject(CGenericItem* pItem)
{
static UINT nIndex = 0;
*(m_pStack+nIndex) = (PVOID)pItem;
nIndex++;
}
The above doesn't work? I'm getting a void * 'unknown size' does that mean...??? I figured any pointer would be 4 bytes or does it mean the size of the object..???
static casts won't work because the object passed to the above function will never be the same object (ALL derived from the same base, but not the same final class)
So:
*(m_pStack+nIndex) = (UINT)pItem;
or something to that effect isn't gonna do...
Is there any way I can use RTTI and determine the class of the object and perform a cast at run time using dynamic_cast ???
Thanx alot
cheers
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hockey wrote:
*(m_pStack+nIndex) = (PVOID)pItem;
when you add a value to a pointer, you are actually adding a multiple of the pointed-to object's size. ie. if m_pStack was an int*, you would be adding nIndex*4 to the ptr address, allowing you to get to item m_pStack[nIndex].
or, as K&R puts it "if p is a pointer to an element of an array, p++ increments p to point to the next element".
but, void has no size, so you can't multiply by it, and you can't have an array of them.
Hockey wrote:
Is there any way I can use RTTI and determine the class of the object and perform a cast at run time using dynamic_cast???
yes.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
I can't have an array of void *'s...???
How does CPtrList work then...???
thanx again.
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
The answer comes in two parts.
1. a list is not an array, it is a data structure where each element knows about it's own data and ( at least ) the location of the next piece of data. Some lists also know the location of the prior item. Advantages of lists: they are quick if you want to add and remove from the middle. Disadvantages: they are slow for lookup of items.
2. How does CPtrList work ? Like all MFC container classes, that is, barely. Use std::list or std::vector instead.
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 )
|
|
|
|
|
It took me a while, but I finally figure that out or so i thought I did, so it's good to hear someone else tell me what a list is and how it differs from an array.
I never cared to think there was a difference before, but now I know there is a crucial difference...
Thanx for clearing that up for me CG...
Cheers
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
you can't have an array of "void"'s.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
I have developed a chat server. In that I want to detect system idle time, if idle time is greater than 10 min then the server should disconnect the client application automatically. For this purpose I am using Idle Time tracker suggested by Sidney, this code I got from codeproject, but its not working fine its disconnecting the client even if the user is using the system.
What could be the problem....I am not getting it. Can anybody help me ?
Prateeti
|
|
|
|
|
Hello,
I'm building an image viewer that would like to use plug-in architecture to extend the functionality of the image format it supports and tools. I also would like to able to provide some basic image manipulation functions to plug-in writers. Anyone can give me some idea how to do it?
Thanks!
|
|
|
|
|
|
hey, how do i add controls like treeview and listview for example, or a richedit to a CDhtmlDialog without having to place it on the dialog resource instead of the HTML... i was thinking of putting some <OBJECT> or some type of code into the HTML to create a control but i don't know how to do that
any ideas?
<div style="width: 100%; background-color: #efefef; border: 1px solid #999999; padding: 2px; margin: 5px; filter: progid:DXImageTransform.Microsoft.Shadow(color=#808080,direction=135,strength=3); text-align: center;">- <b style="font-variant:small-caps">Roman</b> -</div>
|
|
|
|
|
Roman Nurik wrote:
any ideas?
I don't know if this will work.
But if you use the IHTMLDocument Interface you should be create Frames in the View and put your control into that.
Regardz
Colin J Davies
Sonork ID 100.9197:Colin
You are the intrepid one, always willing to leap into the fray! A serious character flaw, I might add, but entertaining.
Said by Roger Wright about me.
|
|
|
|
|
Hi,
I have an MDI application. Suppose the user starts searching for something on one view. Then he/she switches over to another view. Obisouly, since the find dialog was launched with the other view, it won't be associated with the new one. But what if I wanted this to be the case? how do I make a find dialog launched in one view, to be associated with another view whenever the second view becomes active?
thanks
|
|
|
|
|
The dialog communicates with the application using Windows Messages. Define the message handlers on the level of views, then the messages from the search dialog will be received by the current top view.
Sonork 100.15206;PavelK
|
|
|
|
|
I am trying to add records using INSERT INTO
pCommand->CommandText="INSERT INTO tblTest (Color, Texture) VALUES ('navy blue', 'rusty') ";
_RecordsetPtr pRecordset;
hr = pRecordset.CreateInstance (__uuidof (Recordset));
if (FAILED (hr))
{
AfxMessageBox ("Can't create an instance of Recordset");
return;
}
AfxMessageBox("LLL");
pRecordset->CursorLocation = adUseClient;
pRecordset->Open ((IDispatch *) pCommand, vtMissing, adOpenDynamic, adLockBatchOptimistic, adCmdTable);
i get an exception at the Open statement so theres something it doesnt like about the SQL i guess.
ANy ideas wil be appreciated!
Thanks,
ns
|
|
|
|
|
Just out of curosity, since this is an insert, why would you use a recordset for? Try using ExecuteSQL on the connection object.
Also, make sure that pRecordset is not 0 when you are calling the open.
|
|
|
|