|
That's the problem, SHGetFileInfo(...) doesn't return a HIMAGELIST, it returns a DWORD that is the handle of the system imagelist. The only way to make Attach(...) accept it is to cast it to HIMAGELIST, which works fine, but the imagelist contains 0 images (so I don't reckon it worked), although I now have no icons on the start menu anymore!! Anymore ideas? Is there a way to get a handle to the system imagelist via MFC that will return the necessary HIMAGELIST or a pointer to a CImageList object?
Jon.
|
|
|
|
|
Just cast the value returned by SHGetFileInfo:
HIMAGELIST hImgList = (HIMAGELIST)SHGetFileInfo(...);
HIMAGELIST hImgList = reinterpret_cast<HIMAGELIST>(SHGetFileInfo(...));
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
although I now have no icons on the start menu anymore!!
That's because you didn't detach your CImageList from the image list, so the CImageList destructor destroyed the underlying image list. Or you were using a list control and it didn't have the LVS_SHAREIMAGELISTS style, so when the control was destroyed, it destroyed the image list. Oops! Bye-bye icons. You'll need to reboot to fix that.
--Mike--
http://home.inreach.com/mdunn/
Sometimes, arming yourself with a big pointy stake just won't do you any good.
|
|
|
|
|
Send a message to the ListView control (for example):
TreeView_SetImageList(*this, hSysImageList, TVSIL_NORMAL);
Paolo.
|
|
|
|
|
Hi
I will want to know: is latest version of VC correspond ISO C++ Standard?
Ernst
|
|
|
|
|
No, VC 6.0 is not ISO compliant.
Nor will the new version be when Visual Studio NET is released, although it should be alot better than the current version.
Bear in mind that there aren't many ISO C++ compilers available -
In fact I don't believe that there are ANY ISO C++ compilers, but I'm sure someone will correct me if I'm wrong.
James
|
|
|
|
|
The "latest" version of VC++ is 3 years old, and was never intended to be ISO compliant (since the standard wasn't finished when it was written). VC7 will be much closer, but will still lack a few important features like Partial Template Specialization. They claim that VC8 will have a heavy standards focus, and that it won't take 3 years for it to reach the light of day
|
|
|
|
|
We have an app which is associated with graphic files (jpg, bmp, etc). When we drag files of these types over the app and drop them on the mainframe, the app opens an appropriate view.
We also have a document template that allows us to view/edit simple ascii text files. When I drag a .TXT file over the app and drop it, it tries to open a view of the wrong type (a graphics view).
I've tried handling the WM_DROPFILES message in CMainFrame, but the code is never executed.
Does a file extension *HAVE TO BE* associated with the app before I can successfuylly drag a file into the app?
|
|
|
|
|
Make sure the window has the extended style WS_EX_ACCEPTFILES set.
Alternatively you can use DragAcceptFiles.
|
|
|
|
|
Does a file extension *HAVE TO BE* associated with the app before I can successfuylly drag a file into the app?
I don't think so. I've just successfully dropped .txt file into my MFC app that doesn't even have a template for such files (of course, I've got parsing error, because program doesn't read plain text).
Can you post relevant parts of CYourApp::InitInstance (especially, the AddDocTemplate calls) ?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
In InitInstance(), I have this:
DragAcceptFiles(TRUE);
EnableShellOpen();
RegisterShellFileTypes(TRUE);
I added a handler for the WM_DROPFILES message, but it never gets into that message handler function.
I think it might be Stingray's code that's interfering.
|
|
|
|
|
In InitInstance(), I have this:
In fact, I was expecting AddDocTemplate calls Anyway, if the doc is opening but the type is wrong, put the breakpoint in CDocTemplate::MatchDocType (mfc\src\doctempl.cpp, line 186 on VC6 SP5) - this method is called by MFC when file is dropped onto mainframe. Matching is done by comparing file extensions - you'll be able to see exactly what's going on.
Have no idea on Stingray's impact. Hate the toolkit, have to live with grid
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
i have a program that connect to odbc((user DSN))
and i want to install it with installshield
i don't know that set odbc connection in install shield.
thanks .
|
|
|
|
|
What I am trying to do is do is to add a new entry to a database table with an
SQL insert-statement, and then find the, by the DBMS, auto-assigned id for the new entry.
So far I've managed to accomplish this by first using the SQLExecute command,
followed by a select-statement to identify the id of the new entry.
Unfortunately I've stumbled across a table containing lots of dublicates,
where I've found no way to uniquely identify the new entry using a select-
statement.
Is there any other way than using a select-statement to find the id for my new
entry? The only one I can think of is looking for the highest id in the table,
and assume that this is the id I'm looking for. This, I feel, is kind of risky
though, since I'm not sure about how id's are assigned in the DBMS (Microsoft
SQL Server). If the DBMS decides to start reusing lower order id's my program
would stop functioning correctly.
Any advice would be much appreciated.
Thanks,
Jimmy Ehrnström
|
|
|
|
|
SQLServer has system variable @@IDENTITY that returns the last-inserted identity value.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Thanks, but I still can't get it to work. @@IDENTITY returns NULL and not an id. I've read all information about this I could find but found no explanation of what's wrong.
Here's a sample of my code:
pDB->ExecuteSQL(sql);
CRecordset rs(pDB);
if (rs.Open(CRecordset::snapshot, _T("SELECT @@IDENTITY"), CRecordset::readOnly)) {
if (!rs.IsBOF()) {
rs.MoveFirst();
CDBVariant dbId;
rs.GetFieldValue((short)0, dbId);
rs.Close();
if (databasId.m_dwType == DBVT_LONG)
int entryId = databasId.m_lVal;
}
}
Thanks,
Jimmy Ehrnström
|
|
|
|
|
I'm create IWebBrowser2 interface and when I Navigate2 to a particular web page I get a dialog box with "java.lang.NullPointerException..." messagebox.
Is there any way to prevent the browser displaying such messages?
Regards and TIA
Norm
|
|
|
|
|
Hello. I wrote a dll-based plugin for Winamp and it works
fine until I close Winamp. When I do this Winamp crahes with an access violation. I have done some detailed debugging but it feels like a problem that might stem from my modest level of experience with DLLs. Any thought would be very valuable.
Thanks
|
|
|
|
|
Post your code. There's no way for us to answer without seeing some code.
--Mike--
http://home.inreach.com/mdunn/
Sometimes, arming yourself with a big pointy stake just won't do you any good.
|
|
|
|
|
HI All
I 'm program midi player app !
IF any body have a source code by low level please give me
thanks
my mail : kemongmo@yahoo.com
|
|
|
|
|
http://www.maxmidi.com has what you need.
|
|
|
|
|
I want to implement Drag and Drop functionality for CListBox. It can be implemented for CListView but not for CListBox. if there is any idea please suggest me it's urgent.
|
|
|
|
|
Check out CDragListBox which supports reordering the list items.
--Mike--
http://home.inreach.com/mdunn/
Sometimes, arming yourself with a big pointy stake just won't do you any good.
|
|
|
|
|
Is there a way to send email (with attachments too) without calling an smtp server? Is there an article for this or an API call or code somewhere? I'll bet this a pretty frequently asked question but I can't find any answers.
Thank you!
Alex Griffing
|
|
|
|
|
I know with this article, you have to specify an SMTP server, but perhaps the code will get you going in the right direction.
PJ Naughter's CSMTPConnection.
Jon Sagara
"Go Banana!" -- Ralph Wiggum
|
|
|
|