|
klboy wrote:
how to switch the input focus from a console window back to the application window
What do you mean ? I don't understand your question here. Do you have two separate apps (one a console application and the other a windows application) and inside the console application, you want to set the focus to the other application (that is the window app) ?
If yes, you will need to get the handle with FindWindow function.
|
|
|
|
|
cedric moonen wrote:
What do you mean ? I don't understand your question here. Do you have two separate apps (one a console application and the other a windows application) and inside the console application, you want to set the focus to the other application (that is the window app) ?
If yes, you will need to get the handle with FindWindow function.
No i only have one MFC application.
In the my application i have a DLL statically loaded from which i call a function to invoke a debugging console window.
My application communicates to this console window via tcp.
The console acts is the server and my application acts a client.
Now i want to be able to switch to my main application window where i can pressed a key and send a corresponding debug command to the console window.
But atm as soon as i invoke the console window and establish a server-client connection i can't switch back to the my app window.
The console seems to be waiting to receive some data from my application.
I need to switch to the application so that i can press a key for the client to send a debug command to the console.
|
|
|
|
|
Hi!
I use VC++.NET 2003.
I want to compress following text string.
I store following text in std::string.
std::string
a="2B3A2BF0BCD8773D23BEE5550A56E86AF6CF64911214862625027CE7032451282E33F0BFB09D69091D39B1A1788E1A707E50A1948038500CF2044163F379912AD8B59848C7670C94B29B54D2379E2E7AD8B59848C7670C94B29B54D2379E2E7AD8B59848C7670C94B29B54D2379E2E7AD8B59848C7670C94B29B54D2379E2E7AD8B59848C7670C94B29B54D2379E2E7AD8B59848C7670C94B29B54D2379E2E7AD8B59848C7670C94B29B54D2379E2E7AD8B59848C7670C94B29B54D2379E2E7AD8B59848C7670C94B29B54D2379E2E7AD8B59848C7670C94B29B54D2379E2E7AD8B59848C7670C94B29B54D2379E2E7AD8B59848C7670C94B29B54D2379E2E7AD8B59848C7670C94B29B54D2379E2E7AD8B59848C7670C94B29B54D2379E2E7AD8B59848C7670C94B29B54D2379E2E7AD8B59848C7670C94B29B54D2379E2E7A";
I need to compress above string before transferring it from my server.
How do I compress above string into a compressed string (for example,
std::string b;).
Any help will be appreciated
|
|
|
|
|
|
Hi
I want to automate powerpoint presentation into my MFC Dilogue based application. Let me clear it that I don't want whole Power Point but I want to show presentation files directly into my dialogue. Before this also I have requested help here but didn't get satisfactory answer....
Yes I got one or two code which shows how to load power point from my dialogue based application, but it loads power point as seperate application which normally starts when we start it from Start-> Programm -> Microsoft Power Point. Instead i want to show whole power point into my own dialogue of MFC application.
Any example, likn, idea ....
Thanking you guys...
Amarelia Maehsh
Gujarat
India
-- modified at 6:45 Friday 2nd September, 2005
|
|
|
|
|
that day itself i answered with OLE.
anyway see if this is useful for u..
Click Here^
Regards,
V
|
|
|
|
|
Hi there, I am using Visual C++ ( 2003 IDE ) and I need to have 2 classes which points to each other. ( The need to be able to call Functions on each other !!!!!
It works fine from mb->ma but when I call mb from ma I get an error : "Use of undefined Typ" or similiar
Can someone help me. Just need to have 2 Classes being able to call funtions on each other...
<br />
class mb;<br />
<br />
class ma<br />
{<br />
friend class mb;<br />
public:<br />
ma();<br />
int ausgabe;<br />
int mein(void);<br />
int Callb(void);<br />
void SetParent(mb *aptrb);<br />
protected:<br />
mb *_ptrb;<br />
};<br />
int ma::Callb()<br />
{<br />
int lreturn = 0;<br />
mb *lptr = _ptrb;<br />
return lreturn;<br />
}<br />
void ma::SetParent(mb *aptrb)<br />
{<br />
_ptrb = aptrb;<br />
}<br />
ma::ma()<br />
{<br />
int a = 2;<br />
}<br />
int ma::mein()<br />
{<br />
return ausgabe;<br />
}<br />
class mb<br />
{<br />
public:<br />
mb();<br />
~mb();<br />
void tuewas(void);<br />
int richtig(void);<br />
void SetParent(ma *aptra);<br />
protected:<br />
ma *ptra;<br />
};<br />
int mb::richtig()<br />
{<br />
return 500;<br />
}<br />
void mb::SetParent(ma *aptra)<br />
{<br />
ptra = aptra;<br />
}<br />
mb::mb()<br />
{<br />
int a = 2;<br />
}<br />
mb::~mb()<br />
{<br />
int b = 2;<br />
}<br />
void mb::tuewas()<br />
{<br />
int a = 2;<br />
ma *p = ptra;<br />
if ( p != 0 )<br />
{<br />
a = p->mein();<br />
a = a + 3;<br />
p->Callb();<br />
<br />
}<br />
}<br />
|
|
|
|
|
In the .h files of the mb file, add
class ma;
at the begining of the file.
Then in the .cpp file, include the header of this file.
|
|
|
|
|
I alread did that !!
class B;
class A
{
call something on B --- Wont Work
}
class B
{
Call something on A --- Works
}
|
|
|
|
|
You mean everything is in one single file ?? All the functions and everything are in the header file ?
It is better to separate the implementations of the class functions in the .cpp file. If you put that in the header file, when you call something from B in the class A, the compiler only knows that the class exists, but it doesn't know what are the members of the class B. So, put all the definitions of the functions (from classA and class B) in a separate .cpp file. And this is much cleaner that having everything in the same file.
|
|
|
|
|
First of all Thank you very mich Cedric for the quick response....
I already had them in seperate .h and .cpp files but the error in Visual studio was the same....
It seems that Visual Studio is having a problem when I call mb from ma ( *p == p->Foo() ) than the Compile is telling me that I don't have a valid type ???
Thanks
Marcus
|
|
|
|
|
Ok, so if you have forward declaration and all the function defined in a separate .cpp file, this should work (make sure that the header file of class B is included in the .cpp file of class A and the same for class B).
Now, I think this is not due to that fact but probably a syntax error or something like that. It would be really usefull if you post the exact error message (with the error line and everything) and if you could post also the line which gave this error.
Fehma wrote:
*p == p->Foo()
This looks strange to me...
|
|
|
|
|
Thanks I will try it......
With
<*p == p->Foo() > I meant
p->Foo() // Pointer to Object B calls a Function "Foo" on the Object....
|
|
|
|
|
Fehma wrote:
p->Foo() // Pointer to Object B calls a Function "Foo" on the Object....
Yes, that part I understood but why do you compare the result with the object itself ??
*p
Maybe the problem is there: the compiler cannot convert from the return type (probably an int) to the class B...
|
|
|
|
|
Hey,
sorry that ( *p == ) didn't mean anything !!! he he he
I just had forget to delete it...... Typed to much I guess....
Thousand thanx......
I will try it now with the CPP Files and the correct use of include....
A.ccp will include B.h
and
B.cpp will include A.h
right ??
|
|
|
|
|
works no !!!! THANK YOU VERY MUCH
|
|
|
|
|
Hi,
I have a question about static controls and how their backgrounds are painted. If I place a static control on a normal dialog, the background of that dialog is a uniform system grey, and the present static seem to paint their own backgrounds to match that. However, in XP property pages, the background is not uniform, it's a kinda whitish gradient fill. How do the static controls erase their backgrounds here? Do they set themselves to be transparent somehow, and let the parent page paint the whole background over which they just draw the text, but not any background, or do they call some function in the parent page asking it to paint a specific portion of background covered by the static control? I'm asking because I need to replicate this effect, in a custom window of mine. Any clues?
Joel Holdsworth
-- modified at 4:19 Friday 2nd September, 2005
|
|
|
|
|
It`s very simple a Static in requesting a brush(OnCtlColor) from it`s parent dialog, to paint it`s background, you have to give a pattern brush with the portion you need... here it`s an example
if( nCtlColor == CTLCOLOR_STATIC )
{
CRect rc;
pWnd->GetWindowRect(&rc);
ScreenToClient(&rc);
CDC *pBDC = new CDC;
CBitmap *pBmp = new CBitmap;
pBDC->CreateCompatibleDC(pDC);
pBmp->CreateCompatibleBitmap(pDC, rc.Width(), rc.Height());
CBitmap *pOLD = (CBitmap*)pBDC->SelectObject(pBmp);
m_pBackgroundBmp->DrawPart( pBDC->GetSafeHdc(),0,0, rc.left, rc.top, rc.Width(), rc.Height());
pBDC->SelectObject( pOLD );
if(m_hbr) DeleteObject(m_hbr);
m_hbr = ::CreatePatternBrush((HBITMAP)pBmp->m_hObject);
pBDC->DeleteDC();
pBmp->DeleteObject();
delete (pBmp);
pBmp = NULL;
delete (pBDC);
pBDC = NULL;
return m_hbr;
}
int h file you have HBRUSH m_hbr;
NG
-- modified at 6:04 Friday 2nd September, 2005
|
|
|
|
|
Thanks mate. Worked like a charm.
Joel Holdsworth
|
|
|
|
|
Hi guys i sometime get confuse in this?
What is the difference between Instance and Context.
And how two different instances for the same application work.
What are the responsibilities of the OS two maintain the two different instance.
What is the responsibility of the Application developer.
Thanks in advance.
Anil Kumar
|
|
|
|
|
an instance is a representation in memory of a particuliar type (class, struct, union, native type).
when you write int i1 = 4, i2 = 5; , i1 and i2 are 2 instances of an int .
the context is all that can interract with the program and affect the behavior of it (variables values, thread states...)
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hi all
I am using VB 6.0 and trying to use SetForeGroundWindow() API in Windows XP . But the API's behavior seems to be different from Non XP OS , because the minimized Application window gets the focus btu waits for a mouse click to come to fore ground . Is there anyway to make the Application window to come to forground straight away ?
regards
Dharani
redindian
|
|
|
|
|
You can use ShowWindow(SW_SHOWNORMAL);
this is this.
|
|
|
|
|
dharani wrote:
Is there anyway to make the Application window to come to forground straight away ?
What about [SetWindowPos] api
"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
|
|
|
|
|
Are you asking for VB or VC++ code ?
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|