|
I am stuck in device context trouble.
Right now I am conclusion it will be worth to get directly
desktop dc for generic class.
If any body can suggest me way for passing device context to generic class
through thread function or getting desktop dc directly for drawing in generic class.
Here simulate is generic class and the nextpos function is doing lot of drawing stuff.and it needs device context,I have developed SDI application.
and used CView as base.
UINT CMy5CYLINDERView::ThreadFunc(LPVOID pParam)
{
CWnd *cwnd,*cwnd1;
cwnd1 = cwnd->GetWindow(1);
CDC* pDC = cwnd1->GetDC();
simulate* eng = (simulate*)pParam;
eng->nextpos(pDC);
// eng->nextpos(pszWindow);
return 0;
}
void CMy5CYLINDERView::support()
{
for(int ii = 0;ii <= 3;ii++)
{
x[ii] = AfxBeginThread(ThreadFunc,(LPVOID)&engine[ii]);
}
}.
|| ART OF LIVING ||
|
|
|
|
|
whats value cwnd(initialize)
i guess your problem is cwnd1 = cwnd->GetWindow(1);
whitesky
|
|
|
|
|
I tried solutions you given that day but it didnot worked.
How to get the window
CDC* pDC;// = this->GetDC();
HWND hwnd = ::GetActiveWindow();
HDC hdc = ::GetDC(hwnd);
pDC->SetOutputDC(hdc);
nextpos(pDC);
just now I tried longest path it also didnot worked.
I removed thread still I am able to get and pass the dc.
moment I assign anything to pDC it gives error
|| ART OF LIVING ||
|
|
|
|
|
CDC* pDC without value so you get one error pDC=GetDC();
this line has error pDC->SetOutputDC(hdc);
whitesky
|
|
|
|
|
Thanks friend i got my error.
I was calling this support fuction from the constructor before creation of window.
so it was unable to get the device context.now at least I got the dc.
now i am calling it though onlbuttondoubleclick.
As code for support I written much below the file inwhich I was saying this->getdc(),but the this pointer was not of the window.
|| ART OF LIVING ||
|
|
|
|
|
Hai all's
i have done the setting as givin below yet, i found again same problem
whenever executing the program
Could not execute the program Invalid (win32 error 267)
Check the directory settings from the Menu Tools>Options [Directories tab]
If it is incorrect put the correct value
Plz tell me where i am wrong
mailing me
Yogi
|
|
|
|
|
this error is always or now and this error is for all your programs or only for this program
whitesky
|
|
|
|
|
|
Hi,
Is there a way to close an invisible web browser? how do i detect the web browser and close it??
Thanks!!
|
|
|
|
|
You have to do COM Programming. Interface of Internet Explorer com object is IWebBrowser2. You have to get the invisile instance of IE by calling CoGetObject() COM API. Then you can call it's interface methods to close the Invisible Browser.
Once you get the COM instance of API. Then call the COM method ExecWB of IWebBrowser2 with parameter OLECMDID_CLOSE. Then the invisible browser will be closed.
OK ?
Regards,
Benoy Bose
|
|
|
|
|
Hmm ok.. but i cant find CoGetObject in MSDN library. May I know where can i find the declarations?
Thanks!
|
|
|
|
|
KongHL wrote: Is there a way to close an invisible web browser? how do i detect the web browser and close it??
Are you sure there is Invisble Webbrowser
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Yes.. U can create IWebBrowser2 object and make it visible or invisible..
|
|
|
|
|
KongHL wrote: U can create IWebBrowser2 object and make it visible or invisible..
your Answer is hidden in this object!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
??
The problem is i created the browser in a dll (in a thread).. when i tried to terminate the thread, the browser is not closed via the quit() function.
Hence I am trying to close in in the main program.. but this way, i dun have the instance of it.. I need to find it and close it right?
|
|
|
|
|
KongHL wrote: The problem is i created the browser in a dll (in a thread).. when i tried to terminate the thread, the browser is not closed via the quit() function.
Hence I am trying to close in in the main program.. but this way, i dun have the instance of it.. I need to find it and close it right?
Why Not have that Variable of Webbrowser as Class member and pass the current instance of class object to thread, and using that Variable so that you can manipulate the browser from teh Main program..
don't forget to add CoInitialize(NULL)
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Dear all,
How to place SDL ( simple Directmedia layer) in MFC application.So that we can view sample movie from the screen
Manjunath S
GESL
Bangalore
|
|
|
|
|
you answer to many quesitons SDL
Is SDL class?
whitesky
|
|
|
|
|
Manjunath S wrote: How to place SDL ( simple Directmedia layer) in MFC application.So that we can view sample movie from the screen
1) Create your MFC application project.
2) Download SDL runtime library (SDL.DLL) from HERE[^].
3) Copy SDL.DLL into your project folder.
4) Read those documents at SDL website, such as THIS[^] and THIS[^] ...
Maxwell Chen
|
|
|
|
|
|
toxcct wrote: are you kidding ??????
Control your Anger buddy, otherwise i have to call FireFighter
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
it's his 4th post ask with the same stupidity...
and after that, one ask me not to call him "idiot" ?!
damn it
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
Tox sorry to say this. Yes, *YOU* cannot call him an idiot. Its because you have got *MORE* reputation than what you think you have here. People love you *MORE* than what you know here. David Crow asked you not to call him idiot because he was concerned about your reputation. You have a good intellect and a nice helping mind. May be you don't even know me. How many members are there as of now? *A LOT* know you but. So, as David already pointed out, please ignore such posts. Keep your good job up.
|
|
|
|
|
Aljechin wrote: David Crow asked you not to call him idiot because he was concerned about your reputation. You have a good intellect and a nice helping mind. May be you don't even know me. How many members are there as of now? *A LOT* know you but. So, as David already pointed out, please ignore such posts. Keep your good job up.
Yeap you are 100% right! %thumbs Up%
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
toxcct wrote: damn it
Calm down Buddy, thats my only advice to you!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|