|
Se me ha ocurrido otra solución:
Do you think I could work wiht a try-catch block, do that if an error takes place I could detect it, and then I could detect that is the 'not supported by OS' problem and then do the information display I want to do on Win9x machineS?
Thanks for your advice.
n
|
|
|
|
|
Hello, I am getting syntax errors in this file upon compile but I can't figure out what is wrong. Can someone comment?
Thanks.
The errors are:
cinterface3.cpp(17) : error C2065: 'DWORD' : undeclared identifier
cinterface3.cpp(17) : error C2146: syntax error : missing ';' before identifier 'tid'
cinterface3.cpp(17) : error C2065: 'tid' : undeclared identifier
cinterface3.cpp(19) : error C2065: 'HANDLE' : undeclared identifier
cinterface3.cpp(19) : error C2146: syntax error : missing ';' before identifier 'hThread'
cinterface3.cpp(19) : error C2065: 'hThread' : undeclared identifier
cinterface3.cpp(21) : error C2065: 'CreateThread' : undeclared identifier
cinterface3.cpp(23) : error C2146: syntax error : missing ';' before identifier 'CloseHandle'
cinterface3.cpp(23) : error C2065: 'CloseHandle' : undeclared identifier
#include <stdio.h>
#include <string.h>
struct io {
char time[10];
int start;
};
struct io cio;
extern "C" __declspec(dllimport) void _stdcall FTREND3
( long * );
void main (void)
{
DWORD tid, cio;
HANDLE hThread;
hThread = CreateThread(NULL, 0, FTREND3, &cio, 0, &tid)
CloseHandle(hThread);
printf("In c after fortran thread started\n\n");
printf("string = %s\n",cio.time);
}
|
|
|
|
|
#include <windows.h>
is probably missing.
|
|
|
|
|
sorry... the special quote characters are not displayed on this website:
#include "windows.h"
is prbably missing
|
|
|
|
|
I am almost willing to bet that it is because you haven't specified /Mt or /Mtd, ( or whichever it is for your version of VC ), to enable multithreading. The Microsoft headers have a nifty ( not ) set of defines which undef the multithreading functions if the _MT define, ( which comes through the /M... compiler switches ), aren't set.
-=jarl=-
|
|
|
|
|
Thanks all.
The include windows.h cleaned up many errors.
|
|
|
|
|
Hy everybody!
I made an GUI Dll, and I found a problem...
- When I made my Dialog modeless, the default button doesn't work. It only works if the Dialog is Modal
Why?
cheers!
Ricky
|
|
|
|
|
I need to be able to keep all of the controls of a dialog ( for resize purpose )in a list/vector, ... ; so I use GetDlgItem with the controls ID to retrieve the CWnd of each control; but MSDN says that the pointer is temporary.
I don't want to keep a member variable for each control of the dialog; but this is working and might be a simpler solution.
Is there another way to do this ?
Max.
|
|
|
|
|
I think the pointer is temporary because controls can be created and destroyed dynamically. I think you will be fine to leave it the way that it is.
For safety, you may want to make the OnDestroy handler remove the point for that control from the parent dialog class.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Declare an array to save all of controls ID like this:
<br />
int ControlIDArray[]=<br />
{<br />
IDC_BUTTON1,<br />
IDC_EDIT1,<br />
IDC_PROGRESS1<br />
};<br />
A. Riazi
|
|
|
|
|
Hello,
I need to use a template function, but I need that that template function be a class member...
Let's say that I've tried to do:
INSIDE THE HEADER FILE:
template<class T> void MyClass::MyFunction(T& Parameter);
-------------------------------------------------------------------
INSIDE THE IMPLEMENTATION FILE:
template<class T> void CMyClass::MyFunction(T& Parameter)
{
SomeOperations...
}
-------------------------------------------------------------------
HOW DO I CALL THE FUNCTION:
bool b = false;
MyFunction(b); The fact is that using this code I get a lot of errors (one in each MyFunction call) like:
...MyFile.cpp(119) : error C2893: Failed to specialize function template 'void __thiscall CMyclass::MyFunction(T &)'<br />
With the following template arguments:<br />
'bool'
The strange thing is that if I remove the declaration from the class (I've commented it out) and I call the function as a non class member, then it executes well...
I need to be able to call that function while that function would be a part of CMyClass.
Is this possible? and if it is possible, what do I'm doing wrong?
Thank you in advance.
NOTE:
Somebody has told me that this is a weakness of the VC++ compiler, but I continue searching because I need it, what do you believe?
|
|
|
|
|
Firstly, the declaration you have there is not correct. ( or is it just formatting which removes the < typename T > bit ? )
Anyways, ( assuming it is not ), to declare a template member function you have to do this;
in header:
<br />
template< typename T > <br />
void MyFunction( T& );<br />
...<br />
template< typename T ><br />
void MyClass::MyFunction( T & param )<br />
{<br />
...<br />
}<br />
The point is that you can't define a templated method outside of the header-file where it is declared. ( The compiler might not complain, even 7 doesn't, but the linker looses it... )
Secondly, this will only partly work if you have anything earlier than VC 7. VC 6 will do it, however it might fail silently on certain cases which can cause you grief later. ( In particular if you try to specialise the member templates )
-=jarl=-
|
|
|
|
|
Sorry, I've corrected the syntax... could you take other look at it?
|
|
|
|
|
...right, so reading, my reply again I realise that it might not be entirely clear....;P
What I was trying to say was;
Member function templates are poorly supported by VC 6
Member function templates are supported by VC 7, however...
Member function template specialisation is not, ( not properly, anyways ),
What you are trying to do, ( splitting template declaration and definition into
separate files ), is the subject of the mysterious export keyword, which for
numerous reasons has been deemed a red herring.
Unfortunately (?), the only solution is to keep the declaration and definition in the same header file.
If you want to make sure that the linker has a single instance of a template somewhere, ( and not rely on client code usage patterns ), you can instantiate it using the
template keyword on its own, like so;
in some cpp files somwhere...
<br />
template MyTemplatedClass<SomeType>;<br />
this will generate all the code for MyTemplatedClas<sometype> in the cpp file for the linker to use. HOWEVER....this doesn't work for template member functions, only for the whole class, ( or perhaps for free functions. )
So...'tis a bit messy...
-=jarl=-
|
|
|
|
|
aaaarghhh....i hate this... the < typename T > bit keeps getting lost in the wash....
oh well, we now know what we're both trying to say.
-=jarl=-
|
|
|
|
|
Try this approach:
class CMyClass
{
public:
template<class T> void MyFunction(T& Parameter)
{
}
}; Although you can legally move the definition of MyFunction outside the body of CMyClass declaration, VC++ 6.0 crashes at it, so this is your only option (don't know about VC++ 7.0).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Sorry, I've corrected the syntax... could you take other look at it?
|
|
|
|
|
Right,
this has worked well.
Thank you very much.
|
|
|
|
|
btw, just a word of warning:
the VC compiler(s), ( even .NET 2003 ), are experts at throwing up red-herring errors when they encounter problems with templates. The errors you get might have little or nothing to do with the real problem...
-=jarl=-
|
|
|
|
|
I did: this is from an example I found. Now in my old project it shows up as a decent sized panewl, but in this one is tiny! I dont recall what I did specially to make the panel wider before....I have the same code in that project but theres got to be something else I did ....but what? Helllpppp!
int CPaletteStatusBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CStatusBar::OnCreate(lpCreateStruct) == -1)
return -1;
CRect rect(0,0,0,0);
m_THBImageRainbow.Create("Rainbow", WS_CHILD, rect, this, IDC_THBIMAGERAINBOW);
return 0;
}
void CPaletteStatusBar::OnSize(UINT nType, int cx, int cy)
{
CStatusBar::OnSize(nType, cx, cy);
UINT inx;
CRect rect;
inx = CommandToIndex (ID_INDICATOR_RAINBOW);
GetItemRect(inx, &rect);
m_THBImageRainbow.MoveWindow(rect);
m_THBImageRainbow.ShowWindow(SW_SHOW);
}
Appreciate your help,
ns
|
|
|
|
|
I stepped in and inx is coming out to be some really large positive integer...
Appreciate your help,
ns
|
|
|
|
|
the panel associated with your ID ID_INDICATOR_RAINBOW need a string in a string table, and the panel will be sized to fit the string that you set in the resources.
at least that's what I did.
Max.
|
|
|
|
|
That was it-----I now recall doing that in my old project!
Appreciate your help,
ns
|
|
|
|
|
Hi trying to use Visual Studio 6.0 (sp5) but there seams to be some problem with my project. I have copied some source files and stuff from other projects in to this new one and now my class wizard don’t work as supposed any more.
Some of my classes do not show up in the class wizard but they are in the project, I can compile and edit the files. This also results (I think) in that the so helpful “inline help” in the code for those classes do not work when I edit them.
Anyone know of how the wizard store its information or if there is anny tool or other way to fix a
corrupt project like this?
regards Me...
|
|
|
|
|
Hello,
I don't know if there are better solutions (I'm novice)
You can try this:
1) Get a copy of your full project directory in a safe place.
2) Delete the *.clw file (where the class information is stored)
3) Try to access the class wizard (Ctrl + W)
4) regenerate class information from your project files (automatic process)
5) reorganize all your classes in the class wizard tree.
hope this helps...
|
|
|
|