|
I'm really sorry.
I get what your saying, I just can't fill in the blanks.
Are there any full example projects that do this?
|
|
|
|
|
I want to load the icon resource form an application.
What I know by now is that I will use LoadIcon function
HICON LoadIcon(HINSTANCE hInstance, LPCTSTR lpIconName);
how to get hInstance from an application (for example for WORD 2000)?
Please help
|
|
|
|
|
Actually, you might be better off using ExtractIcon()
For an MFC application....
<br />
int nIconIndex = ICON_INDEX;<br />
CString strExeFilename = APPLICATION_FILENAME;<br />
<br />
HICON hIcon = ::ExtractIcon(AfxGetInstanceHandle(), strExeFilename, nIconIndex);
Edited to add : Check out ExtractIconEx() too - this allows you to obtain small and large icons.
|
|
|
|
|
Martyn Pearson wrote:
For an MFC application....
I was about to give the same answer as you, but somwthing told me that the guy who has asked it was not programming using MFC. Then I looked for how to get the hInstance from another application that the own (which is needed with ::LoadIcon() ), and ... I did not find how to do it. Do you know how to do this ? I mean, retrieveing the hInstance of another running instance (with or without MFC) ?
~RaGE();
|
|
|
|
|
I have never extracted an icon from an application because I never had to do it but I do know that ExtractIcon works for API as well. I also remember that if I wanted to get get the module of an application using API I would call HMODULE GetModuleHandle( LPCTSTR pModuleName )
where pModuleName would be the name of a dll or exe. If you use null then you get the current module. This is what I remember doing two years ago, because after that I started working on Unix machines and I kind of forgot most of the API that I knew. I didn't know much anyways.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
Thank for your advices. They are perfect and works fine
So i have another task for you Lets say I have a file and I want to represnt this file (in the list control) by using the icon of the application which this file is related to. (sic anyone understands ?). How to find the application which is the "parent" of a particular file.
Please help
|
|
|
|
|
There could be a function that does this for you - have a browse through the shell functions and interfaces to see if anything pops out. However, you could use this method....
Say for example, you are representing an MS Word document, myfile.doc
If you look up ".doc" in the registry under HKEY_CLASSES_ROOT, you will find the default value is something like "Word.Document.8" - it is on my machine, this may well vary depending on the version of MS Word you have installed.
If you then find "Word.Document.8" under HKEY_CLASSES_ROOT, you will find it has a number of subkeys. Navigate through these subkeys to find the default value for the entry shell/Open/command. (in this case, the full registry path is HKEY_CLASSES_ROOT/Word.Document.8/shell/Open/command)
This contains the name of the executable, which you can then interrogate for the icon!
Hope this helps!
|
|
|
|
|
Thanks but someone helped me already. There is a fuction ExtractAssociatedIcon which does exactly what I need.
Tank you for your help. I really apreciate that.
|
|
|
|
|
Hello i am trying to use the gdiplus.h but i'am not sure how to setup the vc project. I have downloaded the gdiplus.dll but i think that is not enough. Any ideas or link where i could get the relevant settings to use gdi+ in my project
Any help would be a life saver!!
|
|
|
|
|
|
Thanks for your help, I have found good material and i have managed to start work and get every thing to link and compile.
|
|
|
|
|
I have a ".txt" file with m-rows and n-columns of integer values. I want to load them as a m x n matrix. Each value is between tabs.
I would like an implementation of that.
Thank you very much!
|
|
|
|
|
Something like :
int table[m][n];
FILE *f=fopen("file.txt","rt");
if (f!=NULL)
{
for (int i=0;i<m;i++)
{
for (int j=0;j<n;j++)
{
sscanf(f,"%i[here is a tab]",&table[i][j]);
}
}
}
fclose(f);
This is pure C, since I do not know what our app is like. This does not work as is, but it should give you a way to implemente it.
~RaGE();
|
|
|
|
|
Hello,
I need to convert icons to bitmaps. I have written something that works OK on 2000 and other systems but that fail on XP: the transparent color is replaced by black instead of being well transparent. Maybe it is related to getting a "too many color" icon were the 256 colors version is enough for what I am doing...
Does anyone has something to suggest?
Regards
|
|
|
|
|
Can you send me the code?
I worked on somthing that does this exact thing some time ago and i might be able to help you....
|
|
|
|
|
Does your stuff work? My code is just around 10 lines of code where I build a DC, select an empty bitmap into, draw the icon with DrawIconEx in DI_NORMAL mode and that's it. Do you do something similar?
|
|
|
|
|
If you haven't already, you need to look at GetIconInfo. This function fills in a structure
with two bitmap. One is the colour info, and one is the transparency map. The transparent
part *should* be black on the colur bitmap, but you can separate it using the 2nd bitmap
for reference.
Iain.
|
|
|
|
|
Iain,
I saw this one and definitly wanted to take a look at it... Thanks for the infor.
Regards
|
|
|
|
|
Okay tested it but it appears that the bitmaps returned are wrong. Basically I get my icon from the system image list in where the icons are 32 bit with alpha. When I get them I get a 256 color version but the conversion is wrong: some parts of the mask that are gray become black where as in the icon the matching pixel gets black also. So I get black.
What I need now is to force the extraction in 256 colors. The problem is that I get a handle to an icon in the system image list and I do not know where this icon is located on disk so I can't really extract it from the .ico file.
Anyone?
|
|
|
|
|
Hi,
can anybody let me know how to send a text just like popup message to another system(by selecting the username from dropdown box) in LAN through program.
thanx in advance
Thomas.
ThomasKennedyBose
|
|
|
|
|
I don't know special api-calls for this ...
but maybe you can use the Windows command "net send" ???
(translated from a german windows ...)
NET SEND {Name|*|/DOMAIN[:Name]|/USERS} Message<br />
Example:
NET SEND ThomasBoseKenn "Do you need further help ?"
cr97
|
|
|
|
|
thanx...but it should be done through programatically...slect an user name from the dropdown box which displays all the users in one domain,when we click on "Send" button ,string in the edit box should be sent to that user just like a winpopup message(just like NET SEND cr97 "Ya..I need your help?" command works)....
BR
Thomas
ThomasKennedyBose
|
|
|
|
|
And why don't you make a dialog, where the you can select the text and the user ???
And after pressing "SEND" you concatenate all the strings like
<br />
strCall = "NET SEND "+strUserName+" \""+strMessage+"\"";<br />
then you can execute "strCall" ...
is it a solution for you ?
cr97
P.S. Sprichst du deutsch ?
|
|
|
|
|
ya....I have already done that code.....any how I don't leave you ..now you tell me how to get the machine name(like "\\mdpworkstn64")by selecting the username....any APIs??
BR
Thomas
ThomasKennedyBose
|
|
|
|
|
IMHO if you have the user name it is not necessary to know the machine name ...
cr97
|
|
|
|