|
Hi,
Using
CSplitterWnd m_wndSplitter;//header file
//in .CPP file
m_wndSplitter.CreateStatic(this,2,1);
m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CTest1),CSize(rcRect.Width()),rcRect.Height()),pContext);
m_wndSplitter.CreateView(1,0,RUNTIME_CLASS(CTest2),CSize(100,100),pContext); return TRUE;
I have taken an MDI,Default application will be shown Maximized, then i Restore it ,how to handle the Size of the two view.They are show properly.
Thanks in before
James
|
|
|
|
|
RockyJames wrote: They are show properly.
So if they are shown properly, what exactly is the problem?
"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
|
|
|
|
|
Hi
I have created an MFC application which on perticular event creates new desktop using CreateDesktop() functions and then switches to new desktop using SwitchDesktop() function. Also I have used SetThreadDesktop() function to set the current(newly created) desktop as the current one. Now I have inserted one new dialog from Menu Insert->Resources. And created new class for it, Say CMyDlg.
Now after creating new desktop I switch to that new desktop and try to show my dialog over there in this way.
// hDesk is my newly created desktop's Handle.
bRes = SetThreadDesktop(hDesk);
hWnd = GetDesktopWindow();
CWnd *MyWindow;
MyWindow = CWnd::FromHandle(hWnd);
CMyDlg dlg(MyWindow);
dlg.DoModal();
Here it shows the new dialog form on my new desktop, but when I try to move my mouse or try to click any button that I have created, it shows assertions and fails. It shows following error.....saying error in WINCORE.cpp
void CWnd::AssertValid() const
{
if (m_hWnd == NULL)
return; // null (unattached) windows are valid
// check for special wnd??? values
ASSERT(HWND_TOP == NULL); // same as desktop
if (m_hWnd == HWND_BOTTOM)
ASSERT(this == &CWnd::wndBottom);
else if (m_hWnd == HWND_TOPMOST)
ASSERT(this == &CWnd::wndTopMost);
else if (m_hWnd == HWND_NOTOPMOST)
ASSERT(this == &CWnd::wndNoTopMost);
else
{
// should be a normal window
ASSERT(::IsWindow(m_hWnd));
// should also be in the permanent or temporary handle map
CHandleMap* pMap = afxMapHWND();
ASSERT(pMap != NULL);
CObject* p;
ASSERT((p = pMap->LookupPermanent(m_hWnd)) != NULL ||
(p = pMap->LookupTemporary(m_hWnd)) != NULL);
ASSERT((CWnd*)p == this); // must be us
// Note: if either of the above asserts fire and you are
// writing a multithreaded application, it is likely that
// you have passed a C++ object from one thread to another
// and have used that object in a way that was not intended.
// (only simple inline wrapper functions should be used)
//
// In general, CWnd objects should be passed by HWND from
// one thread to another. The receiving thread can wrap
// the HWND with a CWnd object by using CWnd::FromHandle.
//
// It is dangerous to pass C++ objects from one thread to
// another, unless the objects are designed to be used in
// such a manner.
}
}
Any idea how to overcome this? Or any alternative how to show my dialog form on my newly created desktop and use my other events?
With best regards and thankx in advance.
|
|
|
|
|
|
no. if u have the solution tell me
|
|
|
|
|
The MSDN says
The SetThreadDesktop function will fail if the calling thread has any windows or hooks on its current desktop (unless the hDesktop parameter is a handle to the current desktop).
did u checked that ?
nave
|
|
|
|
|
Instead of using this handle i used Current window handle ie
CMyDlg dlg(AfxGetMainWnd());
or
CMyDlg dlg(this);
dlg.DoModal();
Same assertion occurs
bRes = SetThreadDesktop(hDesk);
hWnd = GetDesktopWindow();
CWnd *MyWindow;
MyWindow = CWnd::FromHandle(hWnd);
CMyDlg dlg(MyWindow);
dlg.DoModal();
|
|
|
|
|
No.. thats not the problem...
For u to display a dialog in another desktop...First create a new thread. Then write the above the code in that thread function...
bRes = SetThreadDesktop(hDesk); <br />
hWnd = GetDesktopWindow(); <br />
<br />
CMyDlg dlg; <br />
dlg.DoModal();
plz check if this is working..Also let me know the result
nave
|
|
|
|
|
|
How to get scrool bar of List Control? And make list scroll to some pos.
|
|
|
|
|
use the CListCtrl member function "Scroll"
Scrolls the content of a list view control.
BOOL Scroll(
CSize size
);
Parameters
size
A CSize object specifying the amount of horizontal and vertical scrolling, in pixels. The y member of size is divided by the height, in pixels, of the list view control's line, and the control is scrolled by the resulting number of lines.
Return Value
Nonzero if successful; otherwise zero.
also take a look at GetScrollPos to get the scroll position
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
We have developed one project in which we have to sort out the fields based on filter condition. The project should be similiar to the one we have in the excel sheet. The first Row in data grid control will be static and we cannot edit anything in that. It actually has the column names from the database. But the filter condition has to be placed there. A dropdown box should appear when we click that column name and the unique values residing under that column has to be displayed. The rows in the grid has to be refreshed according to the filter condition we applied.
please let me know the ways in which it can be implemented. please give me the source code if possible.
|
|
|
|
|
by using RegNotifyChangeKeyValue() ,we can notify the changes,then how i can capture the changed key name ,value,status i used RegQueryValueEx(),
i got some garbage value like iiiiiiiiiiiiiiiiii.
Any one give idea about how to capture the name after identifying the notification.
Thanks
Kiran.V
|
|
|
|
|
show the code you are using to capture the change of a key name, and we will see why you get a garbage....
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Hi Yaron,
I want to monitor the changes in the registry,By selecting on of the Root key then monitor the changes in that inlcude key,subkeys.....for name,value and status.
i Add the code in the thread function for monitoring as belowvoid
MonitorThread(void* pParam)<br />
{<br />
DWORD dwFilter = REG_NOTIFY_CHANGE_LAST_SET, dwType, dwSize ;<br />
char lpszUser[81];<br />
HANDLE hEvent;<br />
HKEY hKey;<br />
LONG lErrorCode;<br />
<br />
while(1) {<br />
m_Sec.Lock();<br />
dwSize = 81;<br />
dwType = REG_SZ;<br />
<br />
lErrorCode = RegOpenKeyEx(hKey, NULL, 0,<br />
KEY_NOTIFY | KEY_READ, &hKey);<br />
<br />
hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);<br />
<br />
lErrorCode = RegNotifyChangeKeyValue(hKey, TRUE, dwFilter, hEvent,TRUE);<br />
<br />
WaitForSingleObject(hEvent, INFINITE);<br />
<br />
lErrorCode = RegQueryValueEx(hKey,NULL,0,&dwType,(unsigned char*)lpszUser,&dwSize);<br />
<br />
int item=pList->InsertItem(pList->GetItemCount(),lpszUser);<br />
lErrorCode = RegCloseKey(hKey);<br />
<br />
m_Sec.Lock();<br />
CloseHandle(hEvent);<br />
}<br />
<br />
<br />
<br />
}
For reading root key i put one combo box in the dialog and selecting one root key by pressing start button starts the monitoring ,if any changes occurs in the that rootkey registry display that key name,value ans status(create/modify/delete).
by pressing stop button stops the monitoring
Thanks,
Kiran.V
|
|
|
|
|
I want to defrag and optimize RAM.so that the unreleased memory
will be released.can anyone help me to write the program.
Thanks
nirmal
|
|
|
|
|
I am not sure what you mean by that but if you are talking about physical memory management then look into Address Windowing Extensions provided in Win API. It lets you lock in some pages in physical memory, for example, when you do OS-level optimization of your algorithms working with reasonably large data sets.
|
|
|
|
|
How to improve the resolution of a bitmap in a .bmp file. When I print the bitmap, its resolution is not good.
Can anyone suggest me some code to improve its resolution???
aasstt
|
|
|
|
|
The only reason i can think of that your bitmap resolution is not good, is because you strech it even not intently.
make sure when you blit the bitmap, that the cx and cy are correct (meaning you got them right using the GetBitmapDimentions method)....
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
I have created a compatible DC of the printer DC and then I have Converted DDB to DIB. Then I have written this DIB in a .bmp file. but when I open this file in Paint & give its print its resolution is not good.
aasstt
|
|
|
|
|
Can you be more specific.
|
|
|
|
|
I have created a compatible DC(MemDC) of the printer DC.
Then MemDC->SelectObject(bitmap)
Then whatever I draw on the screen is drawn in memory.
and then I have Converted this bitmap from DDB to DIB.
Then I have written this DIB in a .bmp file. but when I open this file in Paint & give its print its resolution is not good i.e it is not appearing as a smooth image but an image with steps in it.
aasstt
|
|
|
|
|
aasstt,
I dont know your code but I use handle printer dc and I created bitmap
or I load bitmap from file and then print and resolution isnt bad.
Now you have bitmap from file or you created bitmap inside your program
|
|
|
|
|
I have created the bitmap and then written that bitmap using the WriteDIB function(which I have downloaded from codeproject)in a .bmp file.
aasstt
|
|
|
|
|
if you have bitmap(that you created) why you directly print instead save to file and again loaded?if it has handle HBITMAP
|
|
|
|