|
|
Try the following :
either :
- use GetClassLongPtr(hWnd, GCLP_WNDPROC) which should not be changed when a window is subclassed as subclassing is window specific, and this is class specific.
or,
- get window classname
- create a new hidden instance of that window class
- get wndproc of new window
- this should be the same, original, wndproc for all instances of window class
- delete hidden window
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Please let me know how to access the ActiveX control(from 3rd party developed in VisualBasic) from Visual C++ ????
If possible let me know the sample code.
|
|
|
|
|
The language used to write an ActiveX control does not matter.
Look up ActiveX in MSDN. The sub catagory "what is an ActiveX control" points you totorials on ActiveX controls. Also, search codeproject and its' associated web sites for articles on the subject.
INTP
|
|
|
|
|
I am trying to build a number of straight C++ projects that were made with VC6 and I am getting a gazillion template errors. I tried specifically with VS.NET 2003 and it was a horror show of hundreds of compile-time template problems, when I switched to VS.NET (version 1) I was able to fix a mere few errors and it built fine.
Why the big discrepency? Is there a guide of FAQ on common issues for porting VC6 "compliant" template code to VS.NET 2003?
If not there should be because this is a royal pain in the you know what.
Any pointers are appreciated.
|
|
|
|
|
There was a huge leap in C++ standards conformance from VC6 to .NET. If you're having a lot of trouble, it means the original code was not standard conformant.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Ok, that much I understand. How does one go about fixing it? Also, its interesting that I got it built easily in VS.NET but it was so much of a problem with VS.NET 2003.
|
|
|
|
|
Anonymous wrote:
How does one go about fixing it?
By changing the code into proper C++
Anonymous wrote:
Also, its interesting that I got it built easily in VS.NET but it was so much of a problem with VS.NET 2003.
Yeah, VS.NET had a new STL and some improvements, but I'm pretty sure it was 2003 that had the quantum leap.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Eh, tough audience. I guess I am looking for a list of the top areas where VC6 forced you to use non standard template code. Maybe that is too much to ask for, but I'm guessing there are commonly known issues with templates with VC6 that would give me a big head start in terms of converting. I am not a template master and anything that can help would be appreciated.
|
|
|
|
|
Here's an example:
Here's an example:
template <class T> class VertexLock<br />
{<br />
public:<br />
<br />
VertexLock( T* obj, T::LockType lock ) :<br />
m_obj(obj)<br />
{<br />
obj->lockVertices( lock );<br />
}<br />
<br />
<br />
~VertexLock()<br />
{<br />
m_obj->unlockVertices();<br />
}<br />
<br />
private:<br />
T* m_obj;
<br />
VertexLock();<br />
VertexLock( const VertexLock& );<br />
VertexLock& operator=( const VertexLock& );<br />
};
warning C4346: 'T::LockType' : dependent name is not a type
prefix with 'typename' to indicate a type
|
|
|
|
|
<small><b>Anonymous wrote:</b></small>
<i>warning C4346: 'T::LockType' : dependent name is not a type
prefix with 'typename' to indicate a type</i>
This is just a warning, it will still compile, and it's telling you the solution as well. You should check the "Do not treat <'s as HTML tags' box below the post if you want to post template code.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Sorry, there was actually an error message associated with that code, it was the following referring to the first line of the template:
error C2226: syntax error : unexpected type 'T'
error C2334: unexpected token(s) preceding ':'; skipping apparent function body
|
|
|
|
|
Anonymous wrote:
Eh, tough audience
LOL - you get extra credit for having a sense of humour
Anonymous wrote:
I guess I am looking for a list of the top areas where VC6 forced you to use non standard template code.
I don't know of any where it FORCED you, only that it ALLOWED you at times. the only case I know of is the only one that got me when I upgraded, and that only once. I used an iterator as a pointer to the item instead of converting it to be one. But then, I've always been fastidious about C++ syntax.
Anonymous wrote:
I am not a template master and anything that can help would be appreciated.
I'd be happy to help, perhaps if you post some code that is breaking ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
No problem, I know I should probably RTFM but templates is a big subject. I think once i get rolling I'll probably start to pick up the things that are making this break.
Thanks
|
|
|
|
|
I had the same problems as you describe and ended up going back to VC6 because the effort to fix all the compiler errors was not worth it.
John
|
|
|
|
|
BOOL CDC::GetCharWidth( UINT nFirstChar, UINT nLastChar, LPINT lpBuffer ) const;
I found this function a little hard to understand, as stated by MSDN, this function takes 2 UINT's as the 1st and 2nd chars in a consecutive group of characters, the 3rd parameter is an array of int's which is retrieving char widths. This leads to my confusion, in practical, we often want to determine the width of a particular char or string, not something like 'A' to 'Z' or 'a' to 'z'. For example, if I want to know width of string "Hello Code project!" then what should I do? This string has length of 19, do I need to call GetCharWidth 19 times each time pass in something like "'H' to 'H'", "'e' to 'e'", "'l' to 'l'" and so forth?
I mean, why wasn't this function like this: int CDC::GetChatWidth(TCHAR ch) const or int CDC::GetCharWidth(LPCTSTR lpString) const , simply take a char or string and return its width? Sorry if this sounds like a stupid question, but I'm really confused.
|
|
|
|
|
=[ Abin ]= wrote:
int CDC::GetChatWidth(TCHAR ch) const
You can get this by passing in just the char you want, surely ? A helper function to do what you want would be easy to write, just write a CDCFacade class.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
There are some very good applications for GetCharWidth(), determining the display width of string is not one of them. Let's just say it is far more complicated than you want to know at this point in time.
If you need to know the display width and height of a string, use one of the text extent functions: GetTextExtent(), GetTabbedTextExtent(), etc...
Internaly the text extent functions may be calling GetCharWidth() to help in determining the size of the final bitmap image.
I have used GetCharWidth() in the past in order to create DOS style binary font bitmaps for Windows fonts (TT, etc...). That is only one of 2 situation that I found where this function is useful. Of cource if you could figure out what mathimatical algorythms are used to determine charater placement strings in Windows, then by all means write an acticle and let the rest of us know.
If you tried to use GetCharWidth() to determine the displayed legnth of a string, I'm here to tell you that it is not possible unless the font used is not variable spaced. If you dig into the subject you will find that you have to deal with thing like overhang, underhang, spacing between characters, and a whole host of other variables (depending on font type).
The short of it is that GetCharWidth() is only useful in a few specelized situation.
INTP
|
|
|
|
|
Thank you for the detailed explanation.
|
|
|
|
|
How can I prevent my app from being closed (Other than from the task manager)?
What messages can I trap to prevent it from closing?
|
|
|
|
|
OnClose ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I shouldve said it was an SDI app. On close wont work there will it?
|
|
|
|
|
Why not ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I have some code here that I have been playing with to implement a elevator's computer. I have everything kind of mapped out in my head how it's going to work but am having a problem with converting a char to an int. I would like to send the char c to the thread "move( )" and use it as an int. So bacically, How do I convert a char to an int using only djgpp compiler and multi-c operating system.
Here is what I am working with.
void move(char c)
{
}
void getFloor(void)
{
DWORD32 timeout;
short c;
for(;;)
{
BYTE8 floor;
SetCursorPosition(8,10);
while(!ScanCodeRdy())
MtCYield();
floor=GetScanCode();
if ( !(floor & 0x80) )
{
c=ScanCode2Ascii(floor);
PutString(" Floor ");
PutChar(c);
}
}
}
|
|
|
|
|
Conversion between int and char is implicit in C++, dunno about C. But surely a cast will do it ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|