|
Have you tried SetWindowPos . I am a bit tentative about this but you can try.
Nibu thomas
Software Developer
|
|
|
|
|
Hi Nibu,
I tried "SetWindowPos" in view::OnInitialUpdate, like,
GetParent()->SetWindowPos(...). It doesn't work. Even I tried WS_EX_TOPMOST in CChildFrame::PreCreateWindow.
What can we do now?
Sarvan AL
|
|
|
|
|
Sarvan AL wrote: GetParent()->SetWindowPos(...).
Why are you calling the parent's(GetParent()) SetWindowPos . You want to make this child window top most right? So call SetWindowPos for this child window. I guess it will make this child window the topmost in the parent window's child window hierarchy.
Note: I haven't checked it.
Nibu thomas
Software Developer
|
|
|
|
|
Hi Nibu,
Even this also, doesn't give desired results.
void CMyView::OnInitialUpdate()
{
CFormView::OnInitialUpdate() ;
ResizeParentToFit() ;
SetWindowPos(&wndTopMost, 0, 0, 100, 100, SWP_NOMOVE | SWP_NOSIZE) ;
}
But I am not sure that, it is possible to make an MDI child top most. Kindly let know the properties (window styles), the CWnd derived class should have.
Sarvan AL
|
|
|
|
|
I think that using GetParent() or GetParentFrame() is better.
void CMyView::OnInitialUpdate()<br />
{<br />
CFormView::OnInitialUpdate() ;<br />
ResizeParentToFit() ;<br />
<br />
GetParentFrame()->SetWindowPos(&wndTopMost, 0,0,0,0,SWP_NOMOVE|SWP_NOSIZE) ;<br />
}
Sarvan AL wrote: But I am not sure that, it is possible to make an MDI child top most.
This could be the real problem!
|
|
|
|
|
Hi Russel and Nibu,
Still the same prob.
Let me explain the scenario briefly:
I have 7 CFormView derived views. Those should be always topmost. I should have made those windows as MODELESS DIALOGS. But I made a mistake. I need to change the entire architecture of the application. It is painful. If is there any other alternative (to make an MDI child as MODELESS DIALOG), it would be a great solution.
Kindly let me know your suggestion.
Sarvan AL
|
|
|
|
|
Is there any API that can be used to get the path of the Program files directory?
|
|
|
|
|
SHGetSpecialFolderPath .
Steve
|
|
|
|
|
<br />
TCHAR szProgramFilesFolder[MAX_PATH];<br />
if(S_OK == SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, SHGFP_TYPE_CURRENT, szProgramFilesFolder))<br />
{<br />
}<br />
|
|
|
|
|
hi!
i'm using TWAIN to provide support for scanners in my program, part of what you need to do in TWAIN is to "modify the event loop". The PDF documentation for TWAIN posts the following pseudo code:
....
TW_EVENT twEvent;
TW_INT16 rc;
while (GetMessage ( (LPMSG) &msg, NULL, 0, 0) )
{
if Source is enabled
{
twEvent.pEvent = (TW_MEMREF)&msg;
twEvent.TWMessage = MSG_NULL;
rc = (*pDSM_Entry) (pAppId,
pSourceId,
DG_CONTROL,
DAT_EVENT,
MSG_PROCESSEVENT,
(TW_MEMREF)&twEvent);
// check for message from Source
switch (twEvent.TWMessage)
....
Where do I put this block in MFC? Would it be in PreTranslateMessage?
What happens is, I am able to open the TWAIN Data Source Manager, and the message box to select the scanners, there is nothing in the list, and i get the following error in wincore.cpp:
First-chance exception at 0x7c950806 in TWAINTest.exe: 0xC0000005: Access violation reading location 0xfffffffe.
and it breaks at:
// call original wndproc for default handling
if (bCallDefault)
this line--> lResult = CallWindowProc(oldWndProc, hWnd, nMsg, wParam, lParam);
(line 447 or wincore.cpp)
Any ideas?
|
|
|
|
|
I'm supposed to draw string onto a bitmap using GDI+. So how do I check if the string is too long to fit into the bitmap(which is the bounding rect)??
Thank you.
|
|
|
|
|
In GDI+ Graphics class there is a function called MeasureString() which could compute the bounding rect
The DrawText function GDI can also do the same
nave
|
|
|
|
|
Hi,
My graphic application has many graphic objects but some are not
visible all the time according to scrol position of the scrolview.
In my custom dialog I have a picture control . Purpose of this control
is to have a bitmap which should show all the fitted view from this
active scrol view. and should show a non filled rectangle which will
represent the current window content.
In simple words, bitmap will show all the elemnts in the document with
rectangle representing active window content.
Like in game programming wheer in a small winow , all the landscape is
shown and a small rectangle shows your current position respective to
whole scene.
Is it possible to build bitmap from visiable + nonvisible area in a
view. Or bitmap has to be built from document.. how to achieve this.
If its not possible by bitmap then any links or something.
Thanks
cric
|
|
|
|
|
Do you need to create bitmap or scroll bitmap and whats visiable + nonvisible area
|
|
|
|
|
Yes , exactly..I want to have a bitmap created from visible +nonvisible area of scrolview. So end bitmap will show all the area plus a non filled rectangle should be also included in the bitmap which will represent the current visible area. SO I will know where exactly I am in the view compared to whole scenario. Probably you might have seen something in some games.
I want this bitmap to be generated as the view is scrolled. and updated everytime on the picture control on my dialog. all effect should be dynamic.
If there is anyother way then its highly welcom aswell.
Thanks
cric
|
|
|
|
|
Hi there,
I having the problem in GetCurrentDirectory function. When i am from VC++ IDE, the GetCurrentDirectory (GCD) function returns the exact path. But i running after the installing the my application, the GCD function does n't return the path. for eq, if installed in "D:\program files\MyApp\App", it is giving the path as "D:\Documents and Settings\username". how to i get it?
Parthiban
|
|
|
|
|
use
GetModuleFileName()
nave
|
|
|
|
|
If u are doing like this, u have to get the path from GetModuleFileName and set working folder in program.
Is it better to specify the working folder in the link (windows shortcut) itself?
- NS -
|
|
|
|
|
hi,
I am trying to store the value of the drop item in CString. But the problem is the drag drop event doesn't gets fired when i drag and drop an item from one listbox to another. Need help urgently.
Thanks in advance.
|
|
|
|
|
Here[^] is one.
Nibu thomas
Software Developer
|
|
|
|
|
Thanks for the most precise answer.
There is one last problem i.e my list box also contains integer values which doesn't gets droped on the list box. The "DataFormat" has nothing which can check that the data is integer. What should i do.
|
|
|
|
|
Hi all,
I have toolbar with a button as popup menu. It has two menu items, On and Off. I have main menu "Switch" with menu items On and Off.
When I click on Switch -> On, it gets checked. But the toolbar button also pushed. This is because the popup menu should have the same ID as first menu item. I want only the first menu item checked not the toolbar button to be pushed.
Pls refer the MSDN lines:
*************************************************
Nested Pop-up Menus
If you are using a nested menu structure, you will notice that the ON_UPDATE_COMMAND_UI handler for the first menu item in the pop-up menu is called in two different cases.
First, it is called for the pop-up menu itself. This is necessary because pop-up menus do not have IDs and we use the ID of the first menu item of the pop-up menu to refer to the entire pop-up menu. In this case, the m_pSubMenu member variable of the CCmdUI object will be non-NULL and will point to the pop-up menu.
Second, it is called just before the menu items in the pop-up menu are to be drawn. In this case, the ID refers just to the first menu item and the m_pSubMenu member variable of the CCmdUI object will be NULL.
*************************************************
void CMainFrame::OnUpdateSwitchOn(CCmdUI* pCmdUI) <br />
{<br />
pCmdUI->SetCheck((pCmdUI->m_pSubMenu == NULL) && SwitchOn) ;<br />
}<br />
<br />
void CMainFrame::OnUpdateSwitchOff(CCmdUI* pCmdUI) <br />
{<br />
pCmdUI->SetCheck(!SwitchOn) ;<br />
}
How can we use CCmdUI members to solve this.
Thanks in advance,
Sarvan AL
|
|
|
|
|
How to get bandwidth information of Internet through programmatically?
Using C++
pls share any c++ code
Thnaks
-- modified at 1:21 Friday 28th April, 2006
|
|
|
|
|
You'll probably want the Win32_NetworkAdapter WMI class for this.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
When we right-click a edit control, it will pop up a menu. I want to add a item on that menu, but do not know how .
|
|
|
|