|
Thanks Toni, between EnableMenuItem and pCmdUI->Enable() I figured it out.
Frank
"Keyboard Error - Press F1 to Continue"
|
|
|
|
|
You are welcome.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
I am implementing a namespace extension and I need to be able to determine what item is selected in the tree view (left hand pane in explorer) which is an IShellFolder implementation.
I can get the selection notification in the listview (right hand pane) in my implementation of IShellView via the IShellView's WndProc callback, but I can find no such mechanism in the IShellFolder.
Is there another interface in addition to IShellFolder that I need to implement in order to get this info or am I just missing something more obvious?
Many thanks!
Mike Hartway
|
|
|
|
|
I need to record a time from when a button was pushed to the end when the function has finished I would appreciate some help anyone?
[It is possible to represent everything in this universe by using 0 and 1]
I was born intelligent
Education ruined me!.
An idea is useless until it has been implemented.
|
|
|
|
|
get the timestamp time_t when the button is pressed, then the time_t at the end of the function, and do what most of us like to call subtraction to find the answer
time_t m_ltime;
void MyBla::OnButton()
{
time( &m_ltime );
}
void MyBla::Function()
{
time_t time_l;
time( &time_l );
long difference = time_l - m_ltime;
}
######### Here it is in milliseconds
DWORD m_dwTickCount;
void MyBla::OnButton()
{
m_dwTickCount = GetTickCount();
}
void MyBla::Function()
{
UINT difference = GetTickCount() - m_dwTickCount;
}
|
|
|
|
|
yes i already have a time capturer but i need a logging class or something to write to an external file.
[It is possible to represent everything in this universe by using 0 and 1]
I'm going to live forever or die trying.
|
|
|
|
|
it's only 1 int, just serialize it
|
|
|
|
|
I'm trying to figure out how to set the first view (i.e. Icon, List, Details, etc) that CFileDialog uses. It seems to always default to the List style.
I've looked at a some good articles on CFileDialog customization, including:
http://archive.devx.com/free/mgznarch/vcdj/1998/oct98/opensave1.asp
http://msdn.microsoft.com/msdnmag/issues/02/01/c/default.aspx
http://www.codeproject.com/dialog/customize_dialog.asp
and the closest I've come is with a simple class derived from CFileDialog with an over-ridden OnFolderChange(). It's necessary to use OnFolderChange() for the file list access because the list has not yet been initialized when OnInitDialog() is called, and OnFolderChange() is called at the very end of initialization.
void CNewFileDialog::OnFolderChange()
{
CWnd *pW = GetParent();
HWND hWndExplorer = FindWindowEx(pW->m_hWnd, NULL, L"SHELLDLL_DefView", NULL);
if ( hWndExplorer )
{
HWND hWndFileList = FindWindowEx(hWndExplorer, NULL, L"SysListView32", NULL);
if ( hWndFileList )
{
DWORD dwCurrentStyle = GetWindowLong(hWndFileList, GWL_STYLE);
if ((dwCurrentStyle & LVS_TYPEMASK) != m_DefaultStyle)
{
SetWindowLong(hWndFileList, GWL_STYLE, (dwCurrentStyle & ~(LVS_TYPEMASK | LVS_NOCOLUMNHEADER)) | m_DefaultStyle);
}
}
}
}
However, this code only works if the new default style is LVS_ICON, LVS_SMALLICON, or LVS_LIST. Of course, I'm really only interested in setting the default style to LVS_REPORT, but the dialog comes up with a completely empty file list. I think this is because the list headers have not been initialized, so simply changing the style doesn't work. I need to kick-off some kind initialization, or try some other approach.
Any other ideas?
Thanks
Peter
|
|
|
|
|
If it is a timing issue how about using PostMessage() to post a message to yourself which then changes the style.
I'd like to be able to remember and set the list control style in my custom File Open dialog in ED (see sig), but I didn't think this could easilly be done, and haven't tried. However I was thinking along the lines of hooking into the View Menu toolbar button and getting it to set the style to what I wanted. That may be another approach. I already hook the list control and go though all sorts of interesting hoops.
If you find a way to do this please let me know.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
I did think of this approach, but I'm not sure how to do it. I'm actually new to Windows GUI programming, so I'm stumbling around in the dark a bit. What I have tried are WH_CALLWNDPROC hooks for both the toolbar button and the list control and watching all the messages that these controls received. Didn't get to far. Maybe someone has a better way...
|
|
|
|
|
|
As a software developer with an Electronic and Electrical ENgineering bacground, I always wanted to write device drivers and on Windows NT, 2000 and XP. I downloaded the DDK from MS but could not even write a single line of code despite being familiar with Win32 and MFC?
Where do I find a short and very goo tutorial and how do I get to write and run my codes from the Visual Studio Environment??
Thanks in advance.
Inyang Isaac
Isaac Inyang
Ansyl Technologies
|
|
|
|
|
I don't know anything about DDK but I since I wanted to learn how to use it a while ago, I have this link http://www.osronline.com[^].
I just have a question? Do you have to buy DDK because I can't find a link that lets you download it. On Microsoft's website there are links that tell you how to place orders and stuff. Is there a free version?
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Toni78
Pick the followin files:
http://www.vckbase.com/tools/drv/win2kddk.exe [139MB - Win 2000]
http://windriver.ssarang.net/pds/DDK_XP.ISO [65MB - Win XP]
http://download.microsoft.com/download/win98SE/Install/Gold/W98/EN-US/98DDK.EXE [25MB - Win 98]
I hope that helps you. I need a HYPERLINK TO A PAGE where I can get a proper introduction to DDK. Can you help with that??
Isaac Inyang
Ansyl Technologies
|
|
|
|
|
I have the new ddk, but I bought it from M$. It's not free to download anymore, I suggest you take a look at the software bundle you got and make sure it's the ddk.
I also just popped in the DDK setup CD to confirm, there is a whole section of documentation you can install when you double click the setup icon on the CD. When you arrive at the "DDK Group Components" section of the install dialog you can expand the documentation tree node and select them all. Not to mention the wide variety of samples below on the same tree.
I've also seen a recently published MSPRESS book on the new DDK and drivers, so you'll want to pick that up as well.
|
|
|
|
|
I got my DDK from M$ when it was still free. I burnt it on a CD and still have it with me.
Do you get to write your codes from the Visual Studio IDE or do you use a console / command prompt option?
Isaac Inyang
Ansyl Technologies
|
|
|
|
|
I haven't gotten around to writing a driver for my device, (or building my actual device for that matter) so I can't answer your question yet.
I suppose I will use the VC++6 IDE as usual. From all the examples, and source they have on the CD, when you install, I'm sure you can just double click some .dsw's in the samples folder and check out how it's done. That and read that new black cover M$PRESS book on making device drivers.
|
|
|
|
|
Hello all, I am trying to make a program that counts to a certain number and writes to a seperate file when it started and when it ended. Can anyone help me because I'm really new to logging.
[It is possible to represent everything in this universe by using 0 and 1]
I was born intelligent
Education ruined me!.
An idea is useless until it has been implemented.
|
|
|
|
|
There are tons of log file classes on CodeProject.
cheers,
Chris Maunder
|
|
|
|
|
ok Thx I'll try to look....
[It is possible to represent everything in this universe by using 0 and 1]
I'm going to live forever or die trying.
|
|
|
|
|
I am getting confused in declaring a 2d array
I need a n*4 matrix (n rows with 4 cols in each row)
I wanted to do something like
__int8 stepArray[][]={{1,2,3,4},{5,6,7,8}};
corresponds to
1 2 3 4
5 6 7 8
where n is implicitly 2
I am getting an error . Please help
|
|
|
|
|
only last dimension can be undefined
try
__int8 stepArray[2][]={{1,2,3,4},{5,6,7,8}};
better yet use std::vector
|
|
|
|
|
Actually, it's the opposite. The first dimension can be undefined, as in:
__int8 stepArray[][4]={{1,2,3,4},{5,6,7,8}};
|
|
|
|
|
you can use pointers and memmory allocation to do the trick! try this, it should work, I had an assignment on this, a while ago... Let's see if I can dig up some code
__int8 *stepArray[4] = NULL;
stepArray = (__int8 **) malloc(n * sizeof(__int8*));
while(n-- > 0)
stepArray[n] = (__int8*) malloc(sizeof(__int8));
after this, you can use it as a normal 2d matrix (stepArray[n][m] =...)
It is far more easy to use a vector of some sort, but it's more fun to do it yourself (at least, I experience it that way )
hope this helps
ps.
I don't want te scare you, but beware of memory leaks, because they sneak in very easy...
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
(note: italics will contain the text from the documentation of Chris' Grid control. I got it from here)
The underlying class of the grid control is CGridCtrl which is derived from CWnd.
So far, so good
To use it, either use the MS Visual C++ dialog editor to place a custom control on a dialog, and enter "MFCGridCtrl" (no quotes) as the Class name. To subclass the control using the DDX mechanism (this will be done by default by the ClassWizard) use the DDX_GridControl function instead of the DDX_Control function (just manually change the ClassWizard entry). This ensures your control is correctly registered as a drop target and avoids some weird win95 issues.
I am assuming that all of the above is the "either" half of the "either...or" and the below is the "or" half........
Alternatively you can use CGridCtrl::Create:
CGridCtrl grid;
grid.Create(rect, pParentWnd, nID);
where rect is the dimensions, pParentWnd is the parent window, and nID is the id.
Here is where I am stuck. Is nID the control ID of the Grid? Does this mean I still need to create it in the dialog editor? If so, do I still make it a custom control?
I'd really like to use this control. I looked at the demo app and it is really nice!
Any help would be appreciated.
|
|
|
|