|
Never been asked that one. I'd say 'code complete'.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Yes great book. Of course Don Miguel's astute observation[^] raised it's value in my opinion.
Personally I never cared for the question. Might as well ask someone, "If you could be a tree what kind of tree would you be?"
led mike
|
|
|
|
|
Chris Losinger wrote: i've never had to write a program in an interview.
Strange.. i always ask people to write program, when ever i take interview...
my favourite question is print this (using any language of his/her choice)->
*
* *
* * *
* * * *
* * * * *
and you will surprise, 80% of people having 2+ exp couldn't able to write this simple program...
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Re
|
|
|
|
|
dipuks wrote: I would appreciate if someone could guide me on finding some online materials to prepare for an personal interview in C++ and COM.
I don't get this. Either you know the answers, or you don't. Do you know how to write C++ and COM code ? If so, then you shouldn't have a problem. I'd be more worried about if you get questions like 'how would you deal with conflict with a co-worker' and 'what if the lead tells you to do things differently to how you think it should be done' ?
Those questions suck. The tech stuff should be easy, if you know your stuff. And if you don't, no amount of last minute cramming will help. I prefer to be honest in interviews. I think saying 'I don't know, but I know how to find out' at least once in an interview is probably a *good* thing.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Christian Graus wrote: Either you know the answers, or you don't.
Good point.
Best,
Jun
|
|
|
|
|
I have developed the GUI using Visual C++ and need to incorporate the functions into the application. The functions are written in C code.
I have been trying to link the two codes together but things are not working fine.
Approach I took:
1. Inserted the C source code project into my GUI application workspace.
2. Make the GUI application dependent on the C source code project.
3. Included the header files from the C source code project and the compilation was fine.
4. Transfer the functions in main program of the C source code to the GUI Dialog class. No problem in terms of compiling though I am not too sure whether this is correct.
Use the following method for the declarations for the C functions in the header file.
afx_msg void decode(void);
afx_msg void Configure(void);
For the function in the cpp file, I used the following method for the first function to be called. The remaining functions remain as C types function headers. If I remove the C++ function declaration, there will be errors as the rest of the C functions could not be recognized.
void Dialogc::decode(void);
void Configure(void);
5. No problem on compiling. However, during the linking up, there are some extern variables in the image processing files that need referencing to. They are declared in the Dialog cpp file. That is the reason for the "unresolved external symbol _img" and the strings of other error message.
I have tried including the Dialogc.h in the source file of the image processing file and they could not recognize the class terms i.e. more error occurred.
Thanks.
lost in time
|
|
|
|
|
Adding C style code to C++ should be pretty straight forward. Though you should watch out for statements wrapped in #if defined, #endif blocks. Without seeing the code, it's hard to say, but I would guess that is where your error are coming from.
|
|
|
|
|
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...
|
|
|
|