|
tom groezer wrote: Whenever I debug the application i see all the windows flowing over.
Dock them.
Close VisualStudio.
Ope it again and the debugger remembers where you placed the windows.
I would have liked a possibility to fix the window-placement, but I have not found it anywhere.
Failure is not an option - it's built right in.
|
|
|
|
|
According to the KB article Q135788 the below code is the correction action that is to be applied to have the TrackPopupMenu to behave accurately.
Could somebody explain the problem better and provide a deeper understanding?
What is the significance of sending WM_NULL message?
SetForegroundWindow(hDlg);
// Display the menu
TrackPopupMenu( hSubMenu,
TPM_RIGHTBUTTON,
pt.x,
pt.y,
0,
hDlg,
NULL);
PostMessage(hDlg, WM_NULL, 0, 0);
|
|
|
|
|
Posting the null message to the popup menu's owner window forces a task switch to the application that displayed the menu. WM_NULL is chosen as it's a benign message that doesn't do anything more than cause the task switch.
/ravi
|
|
|
|
|
if i understood your question correctly, the according KB article in MSDN describes why this workaround is necessary:
PRB: Menus for Notification Icons Do Not Work Correctly[^]
SYMPTOMS
...
When you display a context menu for a notification icon (see Shell_NotifyIcon),
clicking anywhere besides the menu or the window that created the menu
(if it is visible) doesn't cause the menu to disappear.
...
RESOLUTION
...
The second problem is caused by a problem with TrackPopupMenu. It is necessary
to force a task switch to the application that called TrackPopupMenu at some
time in the near future. This can be accomplished by posting a benign message
to the window or thread.
... So the WM_NULL message is used to force a task switch to the calling app, so when you click outside the popup menu, the popup menu disappears correctly.
cheers,
mykel
OMM: "Let us be thankful we have commerce. Buy more. Buy more now. Buy. And be happy."
|
|
|
|
|
Hi everybody,
i already wrote a function which changes the view of a MDIFrame ( hide old view, show new view )
SetActiveView(New_View);
i add even a New_View->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
and ::SetWindowLong(New_View->m_hWnd,GWL_ID,AFX_IDW_PANE_FIRST);
It works nearby perfect. Only if i minimize the frame.
The new view gets the OnSize-Message and the old view too ( 2 times)
So i've an effect of non-drawing on the new view.
I put a "if(isHidden) return;" in the OnSize-Handler of the old view ( isHidden is setted to TRUE during the view-changing ) which don't resolve the problem
Big thanks for help
|
|
|
|
|
I'm trying to write a program that will connect two computers with a parallel port, be able to send information from one and have the other receive it, and work in Visual C++. I've been researching other programs using the parallel port, and everything I have found is a different type of program (such as LEDs lighting up), won't compile in Visual C++, or is more advanced than I can understand. I attempted to modify the code from the article "How to use serial port to communicate between two computers" and I might have the receive part working, but I can't test it until I finish the other half. I honestly don't think I did it right, so if anyone has any tips or helpful comments, I'd greatly appreciate it.
|
|
|
|
|
I recently got interested in something alike a while back too. the tricky thing is that in windows XP and maybe 2000 etc using windows itself to control the port is blocked, so you must use the dll InpOut32.dll (google it) and take a look at
http://www.logix4u.net/inpout32.htm
http://www.hytherion.com/beattidp/comput/pport.htm
If you still get stuck i can post some of my code when i come home.. (it was only for controling leds and and some inputs, but it may help..) (i controlled a small RC car using the arrow keys ^^ )
//Johannes
|
|
|
|
|
Hi everybody.
I have noticed that some controls in Visual C++ allow to change their font size. Others don´t allow it, and it takes it from the size you set on the Dialog properties.
To change that, I have created my own font with the CFont class like this:
************************************
CFont m_fuente;
LOGFONT lf;
m_fuente.CreateStockObject(DEFAULT_GUI_FONT);
m_fuente.GetLogFont(&lf);
strcpy(lf.lfFaceName,"MS Sans Serif");
lf.lfWeight =700;
lf.lfHeigth =16;
m_fuente.DeleteObject();
m_fuente.CreateFontIndirect(&lf);
****************************************
My question is about the size. Using lf.lfHeigth = 20 will not make words bigger, it will just make the space around the word bigger (check it in a combo box, for example, increasing the lfheigth of a combo box would make the space between words bigger.
Does anybody know how to fix this? Thank you!!!
Time to come clean...
Vive y deja vivir / Live and let live
Javier
|
|
|
|
|
See the nHeight explanation here [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
I guess it is all about that line that I do not understand
nHeight = -MulDiv(PointSize, GetDeviceCaps(hDC, LOGPIXELSY), 72);
Can you explain me what it means?
Thanks!
Time to come clean...
Vive y deja vivir / Live and let live
Javier
|
|
|
|
|
This code is for convert of points to logical device coordinates.
|
|
|
|
|
O_o
Aha...
So how do I say that I want the font size to be 20, for example?
Time to come clean...
Vive y deja vivir / Live and let live
Javier
|
|
|
|
|
garfield185 wrote: So how do I say that I want the font size to be 20, for example?
you have to set nHeight as follows:
nHeight = -MulDiv(20, GetDeviceCaps(hDC, LOGPIXELSY), 72);
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
garfield185 wrote: I guess it is all about that line that I do not understand
You also have to be aware that the system matches your request again available fonts.
garfield185 wrote: nHeight = -MulDiv(PointSize, GetDeviceCaps(hDC, LOGPIXELSY), 72);
Can you explain me what it means?
OK.
It simply states that nHeight isn't the pixel height of the font, but it is related with it by the factor
GetDeviceCaps(hDC, LOGPIXELSY)/72 that is system-dependant.
On my Laptop the factor is 1.33 meaning that I have to specify nHeight=27 (let's forget for the minus sign) to obtain a 20-point sized font (and nHeight=21 to obtain the 16-point one).
On your system maybe the difference between the requested font heights it's so small that the same font is choosen.
Hope that helps.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Excuse my no-knowledge...
No it says that "hDC" is not declared...
What data does the function GetDeviceCaps need? Moreover, I guess LOGPIXELSY is a constant that I must define...
Time to come clean...
Vive y deja vivir / Live and let live
Javier
|
|
|
|
|
hDC must be a valid handle of a device context (HDC).
Using MFC you can pass the HDC of the current window (provided the code belongs to a window class)
nHeight = -MulDiv(20, GetDeviceCaps(GetDC()->m_hDC, LOGPIXELSY), 72);
you can also use the screen HDC for the pourpose:
nHeight = -MulDiv(20, GetDeviceCaps(::GetDC(NULL), LOGPIXELSY), 72);
garfield185 wrote: I guess LOGPIXELSY is a constant that I must define
No you must NOT define it, since it is already defined inside windows.h header file.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Fine. No errors.
Anyway the size does no change. Am I missing something?
Here is all the written code.
************************
CFont m_fuente;
LOGFONT lf;
m_fuente.CreateStockObject(DEFAULT_GUI_FONT);
m_fuente.GetLogFont(&lf);
strcpy(lf.lfFaceName,"MS Sans Serif");
lf.lfHeight = -MulDiv(50, GetDeviceCaps(GetDC()->m_hDC, LOGPIXELSY), 72);
lf.lfWeight =700;
m_fuente.DeleteObject();
m_fuente.CreateFontIndirect(&lf);
m_label.SetFont(&m_fuente);
******************************
Should it be like this?
Time to come clean...
Vive y deja vivir / Live and let live
Javier
|
|
|
|
|
The only problem I saw in your code was the declaration of
CFont m_fuente;
since m_fuente has to be a member of the Window class (otherwise it will be destroyed...)
I declared CFont as a member of my CDialog class and your code is working fine (I see a label with very, very big characters ).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
YEAH!!!! You are the best!!!!
Thanks a lot!! I was creatin m_fuente on each function. I didn´t know it had to be a member of the class... Thank you very much!!
Time to come clean...
Vive y deja vivir / Live and let live
Javier
|
|
|
|
|
garfield185 wrote: What data does the function GetDeviceCaps need?
See here.
garfield185 wrote: Moreover, I guess LOGPIXELSY is a constant that I must define...
No.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Pallini told me about that. I get no errors. What I say is that the code I wrote on the post before does not change the size of the text...
Time to come clean...
Vive y deja vivir / Live and let live
Javier
|
|
|
|
|
Hi,
I have some results calculated in MATLAB. Actually the result is in two arrays namely Bias and Scale Factor. I want the results to be in Coefficients.h. So that I could use it anywhere. Can anyone plaese help me out?
Please
Regards,
Puru
|
|
|
|
|
What does this file contain ? Just plain data (without being C++ specific) ? If yes, why don't you simply read the file in your program ?
I don't see what you are trying to do. Why do you want to convert that to a header file ? Everytime you recompute your results you will need to recompile your application, that seems a crazy solution.
|
|
|
|
|
Cedric Moonen wrote: Everytime you recompute your results you will need to recompile your application, that seems a crazy solution.
Some guy has to tell it to Microsoft, about their string tables!
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hi
I have a problem with msvcrt.dll from WinNT/System32 on windows 2000 (this dll doesn't have _resetstkoflw entry).
My software use this function and it works correctly on Win XP. I use Visual Studio and MFC.
Is it possible to forced my software to load other msvcrt.dll?
Please Help
thanks
|
|
|
|