|
I have created an MDI application whose view is derived from CList. I only have one view and one document. I have used the cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
option to disable the default OnFileNew(). Now I have a application that opens with only a menu. How do I now call my List view(default view) from the mainframe menu? I have added a menu Item, attached a handler to it and tried calling OnFileNew from there. But no List view. Sob. I have read a million msdn files, 2 chapters on MDI applications but still no flashes of intelligence. I'm trying to populate my ListView9defaultview) with items by directly accessing its list control through a call to GetListCtrl() in the OnInitialUpdate() function in my view class. If I take the code populating the control out from OnInitial update, I get a white empty file opening, if I leave it in I get a file with exactly the same grey background as my main window. Am I maybe missing the plot completely? I hope I'm making sense, my brain is so fried it took me 20 minutes to find my office key and leave the building. Please help!
Grasp it but you cannot get it!
It's name is memory..
|
|
|
|
|
Had a cup of tea, am felling calmer so here are more details. The view that I'm trying to call is derived from CListview and is a report style List view showing database information in an Access like gridview.
This is the code I'm using to initialise it
DWORD dwExStyle;
CRepPartDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
//CActionsApp *pApp = (CActionsApp*)AfxGetApp();
CListCtrl& m_List = GetListCtrl();
dwExStyle = m_List.GetExStyle();
dwExStyle |= LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES;
m_List.SetExtendedStyle(dwExStyle);
m_List.SetBkColor(RGB(255, 255, 255));
ASSERT(m_List.GetBkColor() == RGB(255, 255, 255));
m_List.InsertColumn(0,_T("Share"),LVCFMT_LEFT,160);
m_List.InsertColumn(1,_T("Status"),LVCFMT_LEFT,90);
m_List.InsertColumn(2,_T("Action Date"),LVCFMT_LEFT,90);
m_List.InsertColumn(3,_T("Book Date"),LVCFMT_LEFT,90);
m_List.InsertColumn(4,_T("Comment"),LVCFMT_LEFT,160);
I have used it before in a SDI application that opened on this view with no problems whatsoever, which leads me to believe there must be a special way of calling the same view from a menu within a MDI application that I'm missing.
This is the only code I have in the menu handler function at the moment
CRepPartApp* pApp = (CRepPartApp*)AfxGetApp();
pApp->m_pDocManager->OnFileNew();
All the example's I can find deals with multiple document and views and switching between them. It is a new job and I'm feeling a bit incompetent so any pointers would be much appreciated
Grasp it but you cannot get it!
It's name is memory..
|
|
|
|
|
I tried a search but didn't find anyone ever asked this question. Is it too simple?
Well, my question is, in my SDI application, on menu item -- action -- I would display a modeless dialog. the code is:
CMyDialog *pdlg;
pdlg = new CMyDialog();
if ( pdlg != NULL )
{
pdlg->Create(IDD_MY_DLG, this);
pdlg->ShowWindow(SW_SHOW);
}
The dialog shows and functions well, but it would be always on the top, even when it lost focus. Is it possible to hide it behind my SDI application when I click on my SDI?
Thank you!
|
|
|
|
|
You may try with changing 2nd parameter in the call to CYourDialog::Create to GetDesktopWindow().
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi Tomasz, your advice works well to hide my modeless dialog. Thank you!
But by passing GetDesktopWindow() instead of "this" as the second parameter, I couldn't get access to my SDI in the dialog using GetParent(). I need to post back some message to my SDI in the dialog when a button is pressed. Any suggestion?
|
|
|
|
|
hmm, maybe I can add a member variable of CMyview to myDialog and initialize it after I create the dialog.
|
|
|
|
|
Does anyone ever developed one ? Where I can find information about this ?
Mauricio Ritter - Brazil
Sonorking now: 100.13560 Trank
|
|
|
|
|
MDAC SDK should have this info. There's even 'Sample OLEDB Provider' sample, at least in v2.5 which is on my disk.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Tks !
Mauricio Ritter - Brazil
Sonorking now: 100.13560 Trank
|
|
|
|
|
Till now on, i've always just written programs using C, often MFC along with it. But i just keep calling functions and i know how to use all of that but i dont really understand how they work... i mean, i would like to know:
a) Is it possible to directly access hardware through C (like for example video memory)
b) Where can i get examples/source of this?? (for instance winsock source or some display library or something)
I just mean that i would like to be able to work on a lower level closer to the hardware to manipulate it better, like for example whats the code to draw a black pixel on the screen in pure C? don't you need to access the video card or something? (when not using ready-made api's)
I hope you know what i mean...
Thanks.
Kuniva
--------------------------------------------
God gave man a penis and a brain but not enough blood to make both of 'em work at the same time.
|
|
|
|
|
Windows and other OSes generally isolate you from hardware through their abstraction layers. So you can't get the address of video memory and write a byte there. Instead you have to use DirectX, which is a part of OS and provides the programmatic interface for you. The layer between your program and hardware is not very thick in this case.
OTOH, if you want to go hardcore, you'll need to create a device driver. These are the beasts which are allowed to talk to hardware directly.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I'm trying to flush all system buffers associated with a drive on a Win 2k system. The only way I found is to use an Int 21h function 710Dh from the SDK documentation. Can anyone think of another simple way to do this?
I think this will help me with my testing, but it isn't worth spending a lot of time on.
Brad Manske
|
|
|
|
|
Brad Manske wrote:
The only way I found is to use an Int 21h function 710Dh from the SDK documentation.
Does Int 21h work on W2k?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I'm guessing that it will not. The page in the SDK is under a heading for 95/98/ME.
Brad Manske
|
|
|
|
|
I'd look into DeviceIoControl. There's a control code, FSCTL_LOCK_VOLUME, which apparently does flush the buffers. You could lock and unlock immediately. I've never done this, however - treat this with 1e6 milligrams of salt.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
As much as 1 kg. of salt? Perhaps you meant 1e3 milligrams.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Ravi Bhavnani wrote:
Perhaps you meant 1e3 milligrams
No, when I write 1e6 I mean 1e6
This DeviceIoControl is quite low level for my taste. If the guy looses his data, I don't want to be responsible
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Tomasz Sowinski wrote:
No, when I write 1e6 I mean 1e6
LOL
I didn't even notice the quantity specified. Now I feel like I really got my money's worth.
Brad Manske
|
|
|
|
|
I've looked through the documentation and it looks like it might work. If it doesn't, it would only be a little more work to try dismounting the volume. So I now have several more things to try.
Thanks for your help.
Brad Manske
|
|
|
|
|
|
I'm writing my own custom install program. I need to create links in the common desktop, common programs, and common startup directories. I use SHGetSpecialFolderPath to find these directories, but when I run the setup program on NT4 with IE6 I get told it can't find SHGetSpecialFolderPath in SHELL32.dll
Quoting from MSDN...
Requirements...
Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with Internet Explorer 4.0 or later).
When calling SHGetSpecialFolderPath I write "BOOL success = SHGetSpecialFolderPath(m_hWnd, path, ssfCOMMONDESKTOPDIR, FALSE);" for example.
Well the NT4 PC that I'm testing it on has IE6 on it, so in theory should work. Anyone know why I'm getting this error please?
Jeremy Davis
http://www.astad.org
|
|
|
|
|
What version of shell32.dll do you Have?
You need the version 4.71 or later...;)
Best Reagards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
Hmm, I saw that in MSDN. How would I find what version I have? Also why didn't IE6 install the latest version? Thanks for your help anyway.
Jeremy Davis
http://www.astad.org
|
|
|
|
|
Can you run depends.exe on target system and check if Shell32.dll exports SHGetSpecialFolderPath? You'll be able to tell whether problem is located in OS or in your installer.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
... and if you're using GetProcAddress to get the SHGetSpecialFolderPath, do not forget that actual name is SHGetSpecialFolderPathA (if you want ANSI) or SHGetSpecialFolderPathW (if UNICODE is your cup of tea)
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|