|
Use Attach() just like Papa prescribed.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hai,
I do not want to have more than one instance of my app running at a given time. If the app is already running on the machine, I want the invocation of the app to just bring the already running app in focus. I would assume there is a standard way of doing this since a lot of apps do it. Can someone give me an example? Thanks a lot.
|
|
|
|
|
See here and here.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Can anybody help in this problem:
There's an edit control - hwnd_edit.
SetWindowText(hwnd_edit, "A line #1\nHere goes next line");
I need to do this:
|-------------------|
|A line #1 |
|Here goes next line|
| |
| |
|-------------------|
Bus what's up? I see the following:
|---------------------------------|
|A line #1[]Here goes next line |
| |
| |
|---------------------------------|
[] is a small square
How to deal with it?
|
|
|
|
|
Try a \r\n
Make sure that the style multiline is checked
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
\n\r doesn't work - now there are two squares instead of CR LF.
Multiline is certainly checked
XPiS
|
|
|
|
|
XPiS wrote:
\n\r doesn't work
It's important that you use \r\n (not \n\r) as was prescribed.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Try \r\n, or even \r allone.
Jaime
|
|
|
|
|
As far as I know, nothing like that will cause a multil-line title bar. Simply because Windows is meant to be user-friendly (read: consistent).
I dont think using owner-draw for the title bar can accomplish multi-line title bars either.
I suggest u change your strategy and display the required data in an appropriate place.
Again, one of the reasons Windows is popular is because of the GUI consistency it maintains.
Bikram Singh
|
|
|
|
|
Where is there mention of a multi-line title bar? Unless the OP changed his post, he wanted a multi-line edit box. Yes?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
sorry ! my mistake!
Bikram Singh
|
|
|
|
|
I have an MFC based app that uses the SDI methodology .
I have a View that creates and maintains a CWnd derived class pointer (CScreen *ptr) .
Now this app is an interactive GUI and I have to display various Screens for which I have implemented classes that derive from CScreen .CScreenDerived1 , CScreenDerived2
Now based on the stage of the GUI the view creates objects of different types = CScreenDerived1 , CScreenDerived2 using the *ptr to point to derived class objects !
like this in the view.cpp file
<br />
case 1:<br />
ptr = (CScreen *) new CScreenDerived1(this);<br />
break;<br />
case 2:<br />
ptr=(CScreen *) new CScreenDerived2(this);<br />
break; Now i have handled the WM_PAINT message in CScreen by implementing OnPaint
Screen.h file ---------------------------
afx_msg void OnPaint();
Screen.cpp -------------------------------
<br />
BEGIN_MESSAGE_MAP(CScreen, CWnd)<br />
ON_MESSAGE(ID_SCREEN_REPAINT, ScreenRefresh)
ON_WM_PAINT()<br />
ON_WM_LBUTTONDOWN()<br />
ON_WM_ERASEBKGND()<br />
END_MESSAGE_MAP()
Also I want to do specific rendering tasks for which I thought of overriding the OnPaint in the derived classes so Using classView I added an OnPaint Function in CScreenDerved1 and CScreenServied 2 , but I found that the breakpoints that i set in the entry points of these functions was never called .
I found a way that worked where I added the afx call (.h) and the MESSAGE MAP entry(.cpp) in the derived classes and the call was made .
I was assuming that polymorphism will help me out when I directly overrode the OnPaint method in the derived class .
I would be grateful if someone can expalin the mechanism used in this case .
is it because ive done this
ptr=(CScreen *) and forced the type cast !
|
|
|
|
|
That you instantiate the CWnd -derived classes does not mean that they will be displayed. You'll have to call Create and - depending on the styles you set - ShowWindow . You'll also have to move the windows in response to the parent resizing. This is accomplished by handling WM_SIZE in the view (you'll get a function called OnSize ), checking for window existence by testing the m_hWnd member of CScreenX.
|
|
|
|
|
Hi guys
I have a problem , but only happens in XP.
When I open a dialog in my app, I do a movewindow related to the parent position. In W2K the windows is placed exactly where I want and when I execute my app in XP it appears in a higher place than in W2K.
Do you know why could this happens?
What is different in XP that my window is not placed in the same place than in w2K?
Another related question.
Why depending the size of the dialog in W2K it appears correctly and in XP the scrollbars appear?
Best Regards
Doc
|
|
|
|
|
Thank you for your Best Regards
This is intriguing.
I cant be sure exactly, but if you're sure you're code complies with MS dox completely, it wud help if you posted the relevant code.
I would sure like to replicate this !
Bikram Singh
|
|
|
|
|
Thanks in advance for your help
CRect rect,rect3;
m_pParent->GetWindowRect(rect3);
GetWindowRect(rect);
MoveWindow(rect3.left+381,rect3.top+123,rect.Width(),rect.Height(),TRUE);
m_pParent it's a pointer to the dialog parent class.
And Best Regards
Doc
|
|
|
|
|
I suspect there are two problems here.
In MoveWindow() you are using two rects that have different origins
This is from CWnd::MoveWindow in MSDN...
For a top-level CWnd object, the x and y parameters are relative to the upper-left corner of the screen. For a child CWnd object, they are relative to the upper-left corner of the parent window’s client area.
so you need to change the code like this
CRect rect,rect3;
m_pParent->GetWindowRect(rect3);
GetWindowRect(rect);
GetParent()->ClientToScreen(&rect);
MoveWindow(rect3.left+381,rect3.top+123,rect.Width(),rect.Height(),TRUE);
The second problem is the use of constants (381 & 123). All sizing and position calculations need to be relative ALWAYS or you will get lots of problems when you change resolution or other display settings.
I suspect that you had to add these because you didnt call ClientToScreen()
What are you trying to acheive here? Is it to put the child window in the center of the parent?
|
|
|
|
|
Hi Josh
Thanks for your accurate explanation.
The cause to use 2 different rects, is because I use the size (width and height : rect) of the child window to put the child window in a certain point of the parent window (rect3).
What I'm really trying to do is to align the child window in a certain point in the parent window.
What I'm not understand is why in W2K is working always well in all resolutions and in XP not.
Do you know a better way to do this?
Thanks in advance. Anyway, I'll try your solution.
Best Regards
Doc
|
|
|
|
|
Hi,
I try to DLLExport a C++ class that contains an STL container, which gives a a compiler warning. I have "half of an idea" about the why, but it's a bit fuzzy.
I recently found a MSKB article describing what to do in this case - however, I cannot find it anymore. Any suggestions?
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist || Agile Programming | doxygen
|
|
|
|
|
I presume you're talking about warning 4251.
"If your project declares a class class __declspec(dllexport), and that class has members of the std::* type, you see C4251 warnings. Because all your code is built with the std::* class now statically linked, you can ignore these warnings. To explicitly disable those warnings, use the following notation: #pragma warning(disable: 4251)"
This is what I do, and I've never had any problems with it.
Hope it'll help you as well.
|
|
|
|
|
I have an application that needs data from a Database, which will be very large ~ 200K bytes.
I was thinking to exporting this database to a Comma Spearated Format file and creating a library of this data.
e.g.
static int myData1 [64][8] = {0};<br />
static float myData2 [64][8] = {0};<br />
static bool myData3 [128][8] = {0};
The above data arrays would be popluated by a program reading this CSF file
giving:-
static int myData1 [32][32] =<br />
{ <br />
{{1,0},{0,0},{0,0},{0,1},{0,1},{0,0},{0,0},{0,0}, <br />
{0,0},{0,0},{1,0},{0,0},{0,0},{0,0},{0,1},{0,0}, <br />
{0,0},{0,0},{0,0},{0,0},{0,0},{1,0},{0,0},{0,0}, <br />
{0,0},{0,1},{0,0},{0,0},{0,0},{0,0},{0,1},{0,0}, <br />
...
...
etc
i.e. writing the declarations and filling in the initial values (writing the cpp code to a file).
The library would then be built and included in my program.
My question is how to access this data as the library will have no functions, just data.
What I am treying to do is create/fill and be able to use a data structure quick and simple in my program.
Any comments!
|
|
|
|
|
Can anybody help me in replacing a substring:
string s1 = "Here goes string - sample string";
string s2;
...
s1.replace...
...
...
s2 must be "Here goes solution - sample solution"
XPiS
|
|
|
|
|
s2 = s1.Replace("string", "solution");
Check the syntax at MSDN here [^]
...Plug & Pray...
|
|
|
|
|
HI,
I have a Barcode reader ,,that is attahced with COM port.
I wanaa make application that recv the data when i read from Barcode reader ,, n show it ..
any sample .. help
thanx
|
|
|
|
|
I'm looking for a method to get Per Thread CPU Usage in VC++.
I know you can get total with PerformanceCounter _Total - but
I want per thread CPU Usage.
Thanks alot .
|
|
|
|
|