|
Thanks.
I have included all the C style code files into the project and segregated the C code out from the C++ code. It has compiled successfully.
As usual, after one obstacle is overcome, another one appears. Now I have a problem that is related to Winsock2.h.
The below if-define statements were in the program.
#ifdef WIN32
#include <winsock2.h>
#else
#include <netinet in.h="">
#endif
It compiled successfully but during build, two errors occurred.
rtp.obj : error LNK2001: unresolved external symbol __imp__ntohl@4
rtp.obj : error LNK2001: unresolved external symbol __imp__ntohs@4
The problem has to do with ntohl and ntohs that are defined in Winsock2.h.
I have no idea what these two errors are. The program should not have a problem as a build was done in a separate project and it was successful. Please advise. Thanks.
searcher08
|
|
|
|
|
|
I've created an MDI application that has test.cpp and test.h in it.
I've created an IDD (which is a form) called IDD_TEST and declared it in test.h under the //Dialog Data as: enum { IDD = IDD_TEST };
How does one link multiple IDDs ( i.e. if I create IDD_TEST1 ) to 1 class (test.h and test.cpp) so that the variables and event handlers for the controls of both IDDs are located in test.h and test.cpp and I can use them together. (i.e. if m_nCheckBoxTest is in IDD_TEST and m_nCheckBoxTest1 is in IDD_TEST1 I can do:
if(m_nCheckBoxTest.GetCheck() == 1 && m_nCheckBoxTest1.GetCheck() == 1){}
The dilema is I can't fit everything into just 1 form for my I&T GUI....(even with scroll bars enabled...)
Please help...
Kitty5
|
|
|
|
|
could you put all of your handlers in to a single class derived from CDialog (I'm assuming MFC here) and then have the dialogs derive from your handler class?
<br />
class HandlerClass : public CDialog<br />
{<br />
}<br />
<br />
class Dialog1 : public HandlerClass<br />
{<br />
}<br />
<br />
class Dialog2 : public HandlerClass<br />
{<br />
}
cje
|
|
|
|
|
Are you sure you want to do this? Our product currently has this scenario in several places and it is a nightmare to maintain, especialy where help is involved. Just this week I separated one of the .h/.cpp pairs so that each was using its own dialog template. The dialog templates are almost identical so the original author thought it would be neat if only one class serviced both templates. Yuck!
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I am working with RGB colors and am looking for some info on how to perform color manipulation.
Some of the tasks I am trying to accomplish are the following
+Blend two or more colors together to get resulting color from combining 'n' colors.
+Lighten a color so that it looks equivalent to a light source.
+Blend a light source with an object's color to get an approximate color of what the colored object would look like under that light source.
I'm not interested in making images, just in getting a color value compatible with RGB. I'm familiar with the additive and subtractive properties of light and objects as there is ample information regarding light as additive and colored pigments as subtractive on google. Unfortunately, I don't know how to convert that information into the raw utilization of RGB numbers and values and have been unable to find any information or resources on how this might be accomplished.
My goal is to be able to paint a simple rectangle given the RGB light source and the RGB background color and create a new color representative of how the color will look under that colored light.
Thanks
|
|
|
|
|
shoelace wrote: Blend two or more colors together to get resulting color from combining 'n' colors
average the values for each component. res = RGB(R1+R1+...Rn / n, G1+G2+...Gn / n, B1+B2+...Bn / n)
shoelace wrote: Lighten a color so that it looks equivalent to a light source
add a constant to each RGB component. RGB(R + c, G + c, B + c). or, convert RGB to HSL/HSV, increase the L or V parameters, then go back to RGB.
shoelace wrote: Blend a light source with an object's color to get an approximate color of what the colored object would look like under that light source.
i'd start by simply averaging them.
|
|
|
|
|
Hi people
Im filling a CListCtrl with a lot of exe files, and I would like to show the .exe icon next to its name.
I tried the following :
<br />
<br />
hMod = LoadLibraryEx(path, NULL, LOAD_LIBRARY_AS_DATAFILE);<br />
<br />
if(hMod != NULL) {<br />
imageIndex = m_imageList.Add(LoadIcon(hMod, MAKEINTRESOURCE(1)));<br />
<br />
Well, that works just in some cases, but doesn't in a lot.
Does anyone knows what can I do to load the default icon of each exe?
Shouldnt be so hard because explorer.exe open the icon always...
Thanks in advance
|
|
|
|
|
Have you tried ExtractIcon() ?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Awesome, just what I needed, thanks a lot David
|
|
|
|
|
Hey, I tried with extractIcon, but I should still pass as parameter the resource number.
I tried 1 and 0 but still fails to load an icon for a lot of apps, like firefox, winword etc.
Or sometimes the icon is not the one that the .exe uses normally :S
What can I do??
Thanks
Sebastian
|
|
|
|
|
Kharfax wrote: ...but I should still pass as parameter the resource number.
What's wrong with that?
Kharfax wrote: I tried 1 and 0 but still fails to load an icon for a lot of apps, like firefox, winword etc.
Winword.exe does not have an icon 0. It does have an icon 1, however. Have you tried ExtractIconEx() ?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Whats wrong with that is that I should know wich one of all the icons in a file is the default one.
The one showed by windows explorer when you see a file.
Using ExtractIconEx I will get a list of all the icons in the file, but I still need to identify wich one is the default one.
The value I should pass to ExtractIcon is a zero based index array of icons, thats why I tried with 0 and 1.
|
|
|
|
|
FWIW, I believe that the "Default" icon is the first one found in the resources. Barring any more elegant solution, you could always just loop over a few low values to try to find the first icon in the executable. For example, you could always search for values "0" through "100", and stop with the first one found...
You could also try to load the resource information directly from the executable to locate the first one.
I do not suppose that using IDI_APPLICATION with LoadIcon(...) works for you?
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
i think it may also have to deal with the icon windows associates to a type (but i conceed, it doesn't concern the .exes).
|
|
|
|
|
Kharfax wrote: Whats wrong with that is that I should know wich one of all the icons in a file is the default one.
There is no default per se.
Kharfax wrote: The one showed by windows explorer when you see a file.
You can change Windows Explorer to show whatever icon you wish.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Ok granted maybe you can change the icon the explorer choses.
But is choosing and icon, that icon is the same in every machine.
There must be a way to know wich one is the "default" icon of an app.
Maybe ExtractIcon isn't the way. I either dont want to start f***ing around with the PE for something as simple as this...
I'll find it sooner or later...
|
|
|
|
|
ok, the idea is this.
You get the system image list, asociate it with the control, and then call
SHFILEINFO sfi;
memset(&sfi, 0, sizeof(SHFILEINFO));
SHGetFileInfo(sFilename, 0, &sfi, sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
return sfi.iIcon;
The return the index of the icon you should use.
But, doesn't work fine yet, I'm still getting changed icons.
For example...
Firefox.exe gets a folder icon...
|
|
|
|
|
Kharfax wrote: The return the index of the icon...
Are you sure? It should return the handle to an image list that contains the small icon images.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
SHFILEINFO sfi;
memset(&sfi, 0, sizeof(SHFILEINFO));
SHGetFileInfo(sFilename, 0, &sfi, sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
return sfi.iIcon;
Look at the parameters:
SHGFI_SYSICONINDEX, icon index in system image list
SHGFI_SMALLICON, specifies that is a small icon the one I want
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shgetfileinfo.asp
|
|
|
|
|
if you run this code what happens?
|
|
|
|
|
I told what it does a few post up.
It returns the index of the icon in the system image list.
Anyway, that doesn't work well
and that are just chunks of code.
|
|
|
|
|
Try http://codeproject.com/win32/IconExtraction.asp
|
|
|
|
|
Thanks dude, that makes just what I need, but saving the icon as a file :S
I need to get a resource ID or a HICON so I can add it to the list.
I tried to adapt it, but I cant make it work.
Maybe I just lost my patience and focus
|
|
|
|
|
I use this to extract an icon (from any file, not just EXEs).
This will get the default icon from Windows if none is in the exe.
<br />
HICON hIcon = 0;<br />
<br />
<br />
SHFILEINFO shfi;<br />
memset(&shfi, 0, sizeof(shfi));<br />
if (SHGetFileInfo(pszPathname,<br />
FILE_ATTRIBUTE_NORMAL,<br />
&shfi,<br />
sizeof(shfi),<br />
SHGFI_ICON | SHGFI_SMALLICON))<br />
{<br />
hIcon = shfi.hIcon;<br />
}<br />
<br />
<br />
<br />
if (hIcon == 0)<br />
{<br />
LPTSTR pszExtension = PathFindExtension(pszPathname);<br />
CString DummyFileName;<br />
DummyFileName = _T("dummyfile");<br />
if (pszExtension[0] == _T('.'))<br />
DummyFileName += pszExtension;<br />
else<br />
DummyFileName += _T(".");<br />
<br />
SHFILEINFO shfi;<br />
memset(&shfi, 0, sizeof(shfi));<br />
if (SHGetFileInfo(DummyFileName,<br />
FILE_ATTRIBUTE_NORMAL,<br />
&shfi,<br />
sizeof(shfi),<br />
SHGFI_ICON | SHGFI_SMALLICON | SHGFI_USEFILEATTRIBUTES))<br />
{<br />
hIcon = shfi.hIcon;<br />
*pRetImgFlags |= RECORDIMGDATAFLAG_ICONFROMSHELL;<br />
}<br />
}<br />
<br />
if (hIcon)<br />
{<br />
...<br />
Will that work?
Mark
|
|
|
|