|
COLORREF SetPixel( int x, int y, COLORREF crColor );
COLORREF SetPixel( POINT point, COLORREF crColor );
these are the two overloaded functions of SetPixel. So your function call fits the second case and so it will work.
MSN Messenger.
prakashnadar@msn.com
Tip of the day of visual C++ IDE.
"We use it before you do! Visual C++ was developed using Visual C++"
|
|
|
|
|
I think (I'm not sure ) that the compiler will ignore everything that doesn't fit int the macro definition. So for example you can put everything you want after the last zero (if separated by a comma of course, otherwise it will be detected as a single 'variable').
So for example: this will compile:
dc.SetPixel( point, RGB(0, 0, 0, UnknowVariable) );
even if UnknowVariable is not declared.
In fact, a macro is just a way to tell the compiler to replace a portion of text by another text just before the compilation...
Hope this helps
|
|
|
|
|
Hi,
I am trying to create a single-linked list class using templates.
#ifndef CSLLIST_H_
#define CSLLIST_H_
/// HEADER FILE INCLUDES //////////////////////////////////////////////////////
#include "CSLNode.h"
/// CLASS DECLARATIONS ////////////////////////////////////////////////////////
template <class t="">
class CSLList
{
private:
CSLNode<t>* pHead;
CSLNode<t>* pTail;
public:
CSLList();
~CSLList();
bool AddDataToHead(T* pNewData);
bool AddDataToTail(T* pNewData);
bool DeleteDataFromHead(T* pDeletedData);
bool DeleteDataFromTail(T* pDeletedData);
bool IsListEmpty();
bool IsNodeInList(T* pDataToFind);
void PrintListContents();
};
#endif
When I try using the list in main using
CSLList<int> oTempList;
everything compiles but the linker fails with the following errors:
Main.obj : error LNK2001: unresolved external symbol "public: __thiscall CSLList<int>::~CSLList<int>(void)" (??1?$CSLList@H@@QAE@XZ)
Main.obj : error LNK2001: unresolved external symbol "public: __thiscall CSLList<int>::CSLList<int>(void)" (??0?$CSLList@H@@QAE@XZ)
Any ideas on what I am missing? Thanks.
|
|
|
|
|
do you have a function body for your constructor and destructor that it's getting the error on? If so, do they match? If not try this, adding a body to your constructor and destructor:
CSLList(){};
~CSLList(){};
If it's broken, I probably did it
bdiamond
|
|
|
|
|
the constructor and destructor (and all other declared methods) are implemented.
template <class T>
CSLList<T>::CSLList()
{
pHead = pTail = NULL;
}
template <class T>
CSLList<T>::~CSLList()
{
CSLNode<T>* oTmpNode;
while (pHead != NULL)
{
oTmpNode = pHead->GetNextNode();
delete pHead;
pHead = oTmpNode;
}
}
|
|
|
|
|
|
|
Hi there.
The issue I am facing is pretty different for me. Let me explain this with an example, whenever we install my application, a button was created in Internet explorer toolbar. This button is used to activate the Dialog box where I have created some controls. Now, I want to have the same sort of button on MSN Messenger, so that I can activate/invoke the same Dialog box I am using with Internet Explorer.
So, my main problem is to have a button on MSN Messenger screen and then linking that button with the code I want to call.
Thanks and Regards,
Pankaj Bhalla
pankajbhalla@mantraonline.com
|
|
|
|
|
I dont know why ppl wants to put buttons in MSN messenger, yahoo messenger and what not....
If the MSN messenger is not documented to work the way IE works(for customisability) then you cant effectively put buttons into that.
MSN Messenger.
prakashnadar@msn.com
Tip of the day of visual C++ IDE.
"We use it before you do! Visual C++ was developed using Visual C++"
|
|
|
|
|
Hi there.
So, sir you mean, by no way we can create buttons on MSN messenger. One more issue, do u know how to invoke outlook from VC++ application. I mean, i do not want to send the mail directlty, I want to have Outlook up, so that user can type in the subject and message and then can send the email.
Thanks and Regards,
Pankaj Bhalla.
Pankaj Bhalla
|
|
|
|
|
This will give you some idea Click Click[^]
MSN Messenger.
prakashnadar@msn.com
Tip of the day of visual C++ IDE.
"We use it before you do! Visual C++ was developed using Visual C++"
|
|
|
|
|
Consider the following:
string mystring[] = {"Hello","World"};
How do I find how many elements my array of has?
If for example I wanted to loop through the array and count the elements that had the letter 'L' or 'l' in them.
displaying something like:
element 1: 2
element 2: 1
My main focus here is how do I find out the number if elements in a given array.
Thanks in advance for your help.
|
|
|
|
|
sizeof( )
is your friend here.
Remember, it will give you the size of the whole array,
so you have to divide by the size of each element.
|
|
|
|
|
I know with regular arrays you would do a sizeof(mystring)/sizeof(string), but I really don't know about with string variable types.
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Cool,
What about if we take it one step further and have this:
int main()
{
string mystring[] = {"ASD","asdf"};
int i;
i = myfunc(mystring[]);
cout << i;
return 1;
}
int myfunc(string mystring[])
{
int i;
i = sizeof(mystring) / sizeof(mystring[0];
return i;
}
I get two different results when using the sizeof() in myfunc and sizeof in main....
Do I need to pass a pointer to the string??
|
|
|
|
|
You must pass the array size to myfunc. Myfunc receives a string pointer (that's all an array really is, a pointer to a contiguous block of strings), and has no way of knowing the size of the array that pointer points to.
Inside the main function, the compiler substitutes the sizeof operator for the actual known size of your string array. However, inside the myfunc function, the compiler has no way to determine the size of the array passed. If you print the sizeof(mystring) in myfunc, you'll find it always equals 4, the size in bytes of a pointer (on the x86 architecture).
It would probably be better if sizeof() never worked on arrays at all. At least then it would be consistent and less likely to confuse people who've never run into this before.
|
|
|
|
|
It might be preferable to find a way to use
vector< string > mystring ;
Then mystring.size () is obviously the size...
Otherwise you could use a sentinel,
<br />
string mystring [] = { "Hello", "World", "" } ;<br />
<br />
void DoSomething ( string mystring [])<br />
{<br />
while ( !mystring->empty ())<br />
{<br />
DoSomethingWithMystring ( mystring ) ;<br />
++mystring ;<br />
}<br />
}<br />
Paul
|
|
|
|
|
I've finally made my DLL (with help that I am truly grateful for from many members of CodeProject - thanks for being patient ) .However I actually made the DLL to be called from Delphi instead of VB. I have been using VB because I know VB. But the function in the DLL accepts strings, which for VB I have used BSTR and __stdcall. Can I still use BSTR for Delphi and what about the calling convention? Thanks in advance for all your help!!!
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Just google it.
Actual Linux Penguins were harmed in the creation of this message.
|
|
|
|
|
If your DLL api's input is a BSTR then the code in delphi has to pass the parameters in BSTR.
otherwize it will simple not work.
MSN Messenger.
prakashnadar@msn.com
Tip of the day of visual C++ IDE.
"We use it before you do! Visual C++ was developed using Visual C++"
|
|
|
|
|
I am facing a head scratching problem in building a Win32 Dll. I have some C++ classes in the Dll and I want to access these classes in a C++ client. These classes contain some static data and also Dll has some global data. I have successfully build the DLL, but when I use this DLL in client, I get Linker error "LNK2001: unresolved external symbol" for static as well as global data.
I viewed the exports of dll with dumpbin utility and dumpbin shows this data exported but linker is not finding it in the dll. I read somewhere that there is a SECTION statement in .DEF file which deals with the defualt scope of global and static data in a DLL. Can this be used to rectify this problem and if yes then how? As a note, I am not using .DEF file to build the dll, I am using __declspec(dllexport) keyword to export classes and global data from dll.
Please help me, I am scratching my head at the moment.
|
|
|
|
|
You sound like you're a lot smarter than me, so please forgive me if I sound stupid. But I was just wondering if you're actually #include-ing the header file and linking to the .lib file. Or don't you have to do this? Please don't think I'm being sarcastic, but I've just gone through a DLL hell of my own and I'm still kinda new, so I'd also like to know the answer;)
If it's broken, I probably did it
bdiamond
|
|
|
|
|
yes, I m including the header file and also linking with .lib file but ...........................
|
|
|
|
|
sorry, that's about the extent of my knowledge. Wish I could've been more help
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Hi there.
I am facing an issue. I am not able to invoke MS Outlook Exp. from my VC++ application. What I need is, when I click on a button, Outlook exp. should came up with an E-Mail address that we are getting from our own database.
Thanks and Regards,
Pankaj Bhalla
pankajbhalla@mantraonline.com
|
|
|
|