|
lol sorry I meant I had the code - ages ago.
oh! it's still on my wall...
template<typename x>
int Temp1(X &A, X &B)
{
X Var;
Var = A + B;
return Var;
}
Obseve everything, remember more...
|
|
|
|
|
Oh, I thought you were trying to do a swap. This is an add, and I'm not sure it has any value over simply adding without the function call. It will not compile if the type in question does not have an operator +. Because your return type is 'int' it also will not compile unless the template argument is a number, and it will give warnings because it will strip floating point numbers down to an int.
Swap would look like this ( except you'd add the template arguments being stripped by the site because neither of us checked 'show message as-is' )
template
void Temp1(X &A, X &B)
{
X Var;
Var = A;
B = A;
A = Var;
}
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
I was interested in using the "Microsoft Forms 2.0 Frame Control" but this control can't be used outside of VB (If you try it, the "GetObject" method gives you an useless dispatch)so anybody has a similar control or knows how to make it?
Thanks in advance
|
|
|
|
|
I need help - how to put my working application's icon in the taskbar notification area (the system tray) instead of its default position in the taskbar when minimized? Shall I change some registry key or…?
|
|
|
|
|
There are some samples like:
http://www.codeguru.com/shell/systemtray.shtml
If aplication's window is visible and you don't want
to see it in a bar next to Start button, you have to
hide its parent window (if here is any).
Anyway if you need just put icon to system tray
you can find inspiration in sample above.
viliam
|
|
|
|
|
Please tell me is it possible to build applications under Visual C++ 7.0 and to work under Windows 98. I tried in Property Pages/Configuration Properties/Linker to set optimization for Windows 98 but no result! What shall I change?
|
|
|
|
|
Yes, it is.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
You don't even need to enable optimizations for Windows 98 to run programs built with VC7 on 98.
Try to figure out what bugs in your code are causing the program not to work with 98.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
hello @all,
i connected my mfc program and an access database with ODBC.
<br />
CDatabase db;<br />
db.Open(_T( "MyDatabase" ), FALSE,<br />
FALSE, _T( "ODBC"));
the ODBC driver of my database is called 'MyDatabase'. but when i use this code, the database is not selected. i must select it myself!
what must i change to select my odbc driver from the program (i have to do nothing, after i start the program)?
thanks
mfc
|
|
|
|
|
Is there a reason you are using ODBC and not ADO or even DAO?
You'd probably find ADO more friendly and there are plenty of good classes on CP to make it even easier.
Michael
Fat bottomed girls
You make the rockin' world go round -- Queen
|
|
|
|
|
i ever use ODBC (i know, that is no argument ), i think it is better. but i found my mistake. i forgot:
db.Open(_T( "MyDatabase" ),false, false, "ODBC;UID=sa");
thanks for your reply.
mfc
|
|
|
|
|
I created an application with MS Visual C++ 6.0. By doing this the MS Visual C++ studio created some code that uses variables (theApp, m_pMainWnd, m_wndView, m_wndStatusBar). The next thing I did, was creating my own classes (e.g. class CMyClass located in other modules). These classes are not directly related to the WIndows GUI, put perform some kind of I/O.
Now, I want to put the received data in the Client Window of my application (m_wndView) and even put some text on the status bar (m_wndStatusBar). I want to do this from inside my own class CMyClass. I believe I need the correct CWnd handle to do this. So what I'm looking for is a proper method to pass the correct handle to my CMyClass (e.g. in the constructor) and then use this hande inside my class.
Which handle do I need to pass (m_pMainWnd,...) and how do I use this handle to invoke the correct member (e.g. for setting text in the statusbar with the meber SetPaneText)?
Can I find somewhere an example.
P.S.: If you've not noticed by now, I'm a novice.
Thanks !
|
|
|
|
|
HI
Well this SendInput function is giving me a lot of problems i cannot declare KEYBDINPUT and INPUT types VC++ gives me error saying "Undeclared Identifier" i have include "winuser.h" as well as "wndows.h" even checked on the library settings "user32.lib" but no luck still giving me the error i know the syntax but i find myself in a helpless situation please help me out here i even tried this
::KEYBDINPUT but it still gives me error concerning the namespace i dont know wat to do please help me out and yes i am working on windows xp and using visual C++ ver 6.0 i hope these are enuff clues to help u guys figure out the problem
THANKS IN ADVANCE
|
|
|
|
|
You don't need to include 'winuser.h' since it is already included in 'windows.h'.
The only thing you need to do is add the following line of code BEFORE you include 'windows.h'.
So your code should like this:
<br />
#define _WIN32_WINNT 0x0500<br />
<br />
#include <windows.h><br />
Hope this gets you along...
RicoH
Don't think you are, know you are...
|
|
|
|
|
Objective : Want to Paint Toolbar's parent when toolbar is in floating state.
Idea : Subclass the Toolbars parent when its in floating state, and handle WM_PAINT/WM_NCPAINT message to do the required drawing .
Problem : I am not able to understand the concept of subclassing How to subclass ??
following is the code snippet which may help :
<br />
void CMyTB::OnWindowPosChanged(WINDOWPOS FAR* lpwndpos) <br />
{<br />
CToolBar::OnWindowPosChanged(lpwndpos);<br />
<br />
if( IsFloating() )<br />
{<br />
if( m_pDockBar && !m_bDone )<br />
{<br />
CWnd* pParent = m_pDockBar->GetParent();<br />
if( pParent->IsKindOf(RUNTIME_CLASS(CMiniFrameWnd)))<br />
{<br />
<br />
}<br />
}<br />
}<br />
else if( m_bDone ) {<br />
m_bDone = FALSE;<br />
} <br />
}<br />
Help Gurus !!
Abhishek Narula
|
|
|
|
|
"WindowBlinds" never use ModifyMenu or SetMenuItemInfo
and Menu is not with MF_OWERDRAW style. Window never receive WM_DRAWITEM or WM_MEASUREITEM Message.
How can it draw Menu?
|
|
|
|
|
Hi there,How can I draw a rounded bitmap? Thanks a lot!
|
|
|
|
|
You may be able to set a region. Otherwise you can use masking, just like any bitmap which is being drawn transparently with a colour key. I believe TransparentBlt works this way. You'll need W98 or later, and the Platform SDK.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
|
Thanks for the plug
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!
|
|
|
|
|
Use ::CreateRoundRectRgn to create a region with rounded corners. Then call ::SelectClipRgn with your DC that you are going to paint your bitmap onto. The clipping region will prevent your bitmap from painting outside of the rounded rectangle that you create.
Shog9 has listed some articles here on CP that will help you.
Good Luck
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!
|
|
|
|
|
Hi,
I need change a Dos-C program with VC++6.0. In the Dos-C program, there is a piece of 16-bit masm code like the following:
-----------------------------------------------------------
_asm {
les bx, SRB
push es
push bx
lea bx, Aspi
call DWORD PTR [bx]
add sp, 4
}
where Aspi is defined as:
void (__far *Aspi)(u_char far *) = (void __far *)0;
srbExecIo *SRB;
typedef struct {
u_char commandCode;
u_char commandStatus;
u_char hostAdapterNo;
u_char scsiRequestFlag;
u_char reserved1[ 4 ];
u_char targetId;
u_char targetLun;
u_long dataAllocLength;
u_char senseAllocLength;
u_char *dataBuffer;
u_char *srbLink;
u_char scsiCdbLength;
u_char hostAdapterStatus;
u_char targetStatus;
u_char *postRoutine;
u_char reserved2[ 34 ];
union cdbAndSense ca;
} srbExecIo;
--------------------------------------------------------------------
I'm a newer for masm32. I used wnaspi32.dll for aspi-scsi management in new VC++ code.
Would please tell me how to change above code into VC++ code ? and some related setting information?
Thanks in advance!
chen
|
|
|
|
|
iam writing a simple win32 dll.if i want to return the string from dll, there is a warning that warning C4172: returning address of local variable or temporary
i want to know how to return the value correctly.can anyone answer
|
|
|
|
|
Even if you tell us what the warning sayas you HAVE to show us some code also!
It's impossible to help if you don't show us some code snippets!
Are you returning like:
...
return &myVaribleOrObject;
If yes:
Then I can tell that you can't return an address of a local varible from a function. Show me some code and I can help you!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
extern "C" LPTSTR _stdcall ReturnIEVersion()
{
HKEY hKey;
char szIEVersion[MAX_PATH];
DWORD dwType=REG_SZ, dwRetSize = MAX_PATH;
if(ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Internet Explorer",0, KEY_READ, &hKey))
{
DWORD dwType=REG_SZ, dwRetSize = MAX_PATH;
if (ERROR_SUCCESS == RegQueryValueEx(hKey, "Version", NULL, &dwType, LPBYTE(szIEVersion), &dwRetSize))
{
return szIEVersion;
}
else
{
return "IEVersion not found";
}
RegCloseKey(hKey);
}
else
{
return "Open Key Failed";
}
|
|
|
|