|
for the solution of the second problem see "Q187988 - PRB: ActiveX Control Is the Parent Window of Modeless Dialog"
|
|
|
|
|
Ok, I have this ListBox and I want to transfer the String that was selected in this List to a new Dialog.
The Problem is everytime I do dlg.DoModal(); the String reset's to NULL!
Maybe someone can help me!
Thanx
Enzi
|
|
|
|
|
Hi,
The easiest way is to create a member variable CString (or whatever) in each dialog.
Then when you've got the string you want from the list, call:
CMyDialog dlg;
then:
dlg.m_strString = strList;
where m_strString is the member variable for the string in the second dialog and strList is the string that holds the value from the list box.
Then you can call:
dlg.DoModal();
In the second dialog you can no do what you want with m_strString.
Cheers,
Peter
|
|
|
|
|
Ahh thanx!
So if u understood right.
For each variable I want to use in Dialog2 from Dialog1, I've got to make a Variable in the ckass of Dialog2.
Ok thanx for the help!
btw Windows Programming is complicated!!
Enzi
|
|
|
|
|
I would like to concatenate 2 strings like that:"1" and "y" so i would like to know how i have to declare my variables, as string or CString or as LPCSTR?
thanks for your answer
gerald
|
|
|
|
|
Its entirely up to you as to whether you use CString or LPCSTR's
if you use CStrings:
CString a,b,c;
a="hello";
b="world";
c=a + b;
// c is now "helloworld"
or, if you use LPCSTR's:
char a[]="hello";
char b[]="world";
LPCSTR c; // LPCSTR is just a long pointer to a char
c=new char[80]; // some allocation
c=a+b; // is wrong and will probably crash your program
strcpy(c,a);
strcat(c,b);
// c now points to a string "helloworld"
|
|
|
|
|
I'm making a utility plugin dll for 3d studio and I want to use a tree control in it. I have a dialog which contains the treeview, but I don't know how I can use it from the code. I can get the HWND of the ctreectrl, can I distill some kind of workable pointer from it, or something like it? The problem is that the dialog is added as a panel inside 3dstudio max, all I have is a HWND of the dialog.
Thanks,
WAVK
|
|
|
|
|
|
Hi,
I work with Visual C++6.0 SP5 under Windows 2000 SP2
I have theis following problem to compile my project in visual c++6.0
I want to connect to a data source (sqlserver or db2). If i attemp to compile my project, the following error message is display :
------------------------------------------------------------------------------
f:\progra~1\sqllib\include\sqlext.h(1676) : error C2146: syntax error : missing ';' before identifier 'SQL_API'
f:\progra~1\sqllib\include\sqlext.h(1676) : error C2501: 'SQLRETURN' : missing storage-class or type specifiers
f:\progra~1\sqllib\include\sqlext.h(1676) : fatal error C1004: unexpected end of file found
------------------------------------------------------------------------------
Sqlext.h is'nt part of my project
Can anybody help me ?
Thanks in advance
|
|
|
|
|
It probably is part of your project, you just can't see it. Check your include files it is being added by some other file. You may need to change the order of your includes.
|
|
|
|
|
You should make sure Sql.h and Sqltypes.h are included whereever you are trying to use ODBC
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
In my application I'm accessing to several database servers through ODBC (oracle, sql-server, sybase, ...) and I need to access to some system tables, that's the reason what I need to know in which of those systems I'm connected.
I can try to access to a specific table with a "try ... catch" but it's not a "pretty" solution.
Any idea?
Thanks.
|
|
|
|
|
Is can I to return a parameter in the program termination in exe file ?
|
|
|
|
|
look in help for main, wmain etc. - they return int
t!
|
|
|
|
|
Can you explain your answer ???
|
|
|
|
|
your program can look like this:
int main(void)
{
return 7;
}
calling .bat can work with it:
program.exe
if errorlevel 7 goto END
also you can do this:
void main(void)
{
exit(7);
}
it is better now?
t!
|
|
|
|
|
I have recently moved away from MFC, and focussed on Win32 programming instead. But I am having problems with safe drawing of DCs, particularly the SelectObject() and DeleteObject() functions. I know that whenever you create an object and select it, you must get the old object so you can put it back when your finished. I found some source code for this and it went something like this:
HBRUSH hbrNew = CreateSolidBrush(RGB(255, 0, 0));
HBRUSH hbrOld = SelectObject(HDC, hbrNew);
// Drawing Stuff...
SelectObject(HDC, hbrOld);
DeleteObject(hbrNew);
But this doesn't work with the compiler. It has a problem with the hbrOld being a HBRUSH. If anyone can help or tell me how to do it properly, it would be greatly appreciated.
James Bird - birdjames@bigfoot.com
|
|
|
|
|
SelectObject returns HGDIOBJ - you have to cast the return value to HBRUSH --or-- declare hbrOld as HGDIOBJ.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Correct. Either way you will have to use a cast:
method 1:
HBRUSH hMyBrush = CreateSolidBrush(RGB(255,255,255));
HBRUSH hBrushOld = (HBRUSH) SelectObject(myDC,hMyBrush);
//Draw Here
SelectObject(myDC,hBrushOld);
DeleteObject(hMyBrush);
method 2:
HBRUSH hMyBrush = CreateSolidBrush(RGB(255,255,255));
HGDIOBJ hBrushOld = SelectObject(myDC,hMyBrush);
//Draw Here
SelectObject(myDC,(HBRUSH)hBrushOld);
DeleteObject(hMyBrush);
|
|
|
|
|
Either way you will have to use a cast
Not true. Version 2 doesn't need a cast to HBRUSH
HBRUSH hMyBrush = CreateSolidBrush(RGB(255,255,255));
HGDIOBJ hBrushOld = SelectObject(myDC, hMyBrush);
SelectObject(myDC, hBrushOld);
DeleteObject(hMyBrush);
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi all,
I want to use of use of two table in only one CDaoRecordset object ...
Does i must use of two object ???
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
You can use a join as: "SELECT * from table_one,table_two where table_one.column=table_two.column"
Therefore Overload the GetDefaultSQL() function of CDaoRecordset and return "table_one,table_two"
|
|
|
|
|
Hi,
Please explain more about your source code,
And please explain: if i want to write record table1 ? how can i ?
because now i have two table !!!
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hi,
I'm having a rather weird problem here and I thought that maybe, if I described it, it would ring some bells with the experts. I haven't a clue!
Anyway, here's the situation:
We have an in-house developed database-access layer with all kinds of specific goodies in it and for reasons of deployment and ease of upgrade, we isolated it in an MFC extention DLL.
This all worked fine for a couple of months. I can integrate it easily in existing programs and everything works fine... that is, as long as I integrate it in an exe!
The database-access layer in the DLL has a feature which displays a tray-icon. You can see what the layer is doing by looking at the tray-icon's color or by calling a dialog, hidden in the tray-icon's context menu. Of course the dialog and tray-icons are all located in the resource of the extention dll...
As long as I integrate the extention dll in a stand-alone application (.exe), everything works fine, tray-icon included. But when I integrate the dll in an activeX-component (complete with clsid and interface) the tray-icon's icon cannot be loaded from the resource! In release build this results in a tray-icon without an icon (just an empty space) which isn't THAT bad, but when I try to bring up the dialog it fails completely (which you might expect). In debug build I get all sorts of assert-failures saying that the icon HANDLE is invalid...
So how come everything works fine in a stand-alone application and it fails in an ActiveX component?
Structured programming vs. chaotic mind boggling
|
|
|
|
|
use AFX_MANAGE_STATE(AfxGetStaticModuleState()) in your DLL.
see MFC technical note 058 for more info
if it doesn't help, you can set the resource handle manually in the DLL
HINSTANCE hResPrev=AfxGetResourceHandle ();
AfxSetResourceHandle (GetModuleHandle (_T("CT.DLL")));
...
AfxSetResourceHandle (hResPrev);
|
|
|
|