|
I need a HBITMAP to add a bitmap to a toolbar and menu. I can get an HICON from the .exe's that contain the images, but I'm not sure if there is a simple way to get an HBITMAP from the HICON without going through the whole bitblt process.
Any idea if there is a fairly simple way to do this?
Thank you,
Dave
|
|
|
|
|
I am not sure, but perhaps you should have a look at the GetIconInfo Windows API function. This function gives you an ICONINFO struct which contains HBITMAP handles to the color and the mask bitmap.
If you use GetIconInfo you have to delete the handles to the two newly created bitmaps yourself. Read MSDN for more.
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Hi everybody
I'm developing an application for my final thesis. I need to use a Real Time transport protocol to carry some data from a PC to a PDA (Pocket PC). I thought maybe WinRTP could work in the PDA side, but I don't find the "CE version". Actually, i don't even know if it does exist. If it does, where can I find it? and maybe some examples...if it doesn't, any idea what other real time protocol could i use?
Thank you all in advance,
Javi
|
|
|
|
|
Greetings
I am writing an app to import data from an Access DB. I am fetching the information about columns of a table by using the following method -
SQLCHAR colname[SIZE_128+1]={0};
SQLINTEGER colsize=0;
SQLSMALLINT decimaldigit=0;
// allocate.
VERIFY ( (retcode = SQLAllocHandle ( SQL_HANDLE_STMT, sqlhdbc, &hstmt )) == SQL_SUCCESS );
retcode = SQLColumns ( hstmt, NULL, 0, NULL, 0, (SQLCHAR*)szTable, SQL_NTS, NULL, 0 );
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO) {
/* Bind columns in result set to buffers */
SQLBindCol(hstmt, 4, SQL_C_CHAR, colname, SIZE_128, &size );
SQLBindCol(hstmt, 7, SQL_C_SLONG, &colsize, 0, &size );
SQLBindCol(hstmt, 9, SQL_C_SSHORT, &decimaldigit, 0, &decsize );
}
while( TRUE )
{
retcode = SQLFetch(hstmt);
if ( retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO ) {
// do stuff
} else {
break;
}
}
Now the problem is that even if a column is defined as DOUBLE in Access and has data like 2.345, 3.001, 0.0001 etc.
The decimaldigit is always returned with value 0. Therefore I am not able to get the correct decimal point for the column.
So instead of getting colsize = 15 and decimaldigit = 2, I am always getting colsize = 15 and decimaldigit = 0?
Am I doing something wrong?
Thanks in advance.
Karam
|
|
|
|
|
Perhaps you should have something like:
SQL_C_DOUBLE decimaldigit;<br />
SQLBindCol(hstmt, 9, SQL_C_DOUBLE, &decimaldigit, 0, &decsize);
|
|
|
|
|
SQL_C_DOUBLE is defined as 8. So I used
SQLDOUBLE decimaldigit;
SQLBindCOl ( hstmt, 9, SQL_C_DOUBLE, &decimaldigit, 0, &decsize );
For the double column the decimaldigit value is 0.000000000 and decsize it is -1.
I am confused. Even the MSDN docs tell me to use the function this way
|
|
|
|
|
I have never been a fan of SQLColumns.... usually I just do a 'select * from <tablename> where 1=0' and use the following fcns to get metadata (sorry for the code bloat...):
short DBStatement::GetColDBType(int iColumnNum)
{
short iStatus;
char caDummy[2];
short iDummy;
long lColType = -1;
if (m_hStmtHdl)
{
ResetError();
iStatus = ::SQLColAttributes(m_hStmtHdl,(UWORD)iColumnNum,(UWORD)SQL_COLUMN_TYPE,(PTR)caDummy,(SWORD)1,(SWORD *)&iDummy,(SDWORD *)&lColType);
if (iStatus != SQL_SUCCESS && iStatus != SQL_SUCCESS_WITH_INFO)
{
UpdateDBError();
lColType = -1;
}
}
else
NoActiveStatement();
return (short)lColType;
}
LPSTR DBStatement::GetColName(int iColumnNum)
{
short iStatus;
long lDummy;
short iDummy;
InitDataBuffer();
if (m_hStmtHdl)
{
ResetError();
iStatus = ::SQLColAttributes(m_hStmtHdl,(UWORD)iColumnNum,(UWORD)SQL_COLUMN_NAME,(PTR)m_caDataBuf,(SWORD)1000,(SWORD *)&iDummy,(SDWORD *)&lDummy);
if (iStatus != SQL_SUCCESS && iStatus != SQL_SUCCESS_WITH_INFO)
{
UpdateDBError();
m_caDataBuf[0] = 0;
}
}
else
NoActiveStatement();
return m_caDataBuf;
}
long DBStatement::GetColWidth(int iColumnNum)
{
short iStatus;
char caDummy[2];
long lColWidth = -1;
short iDummy;
if (m_hStmtHdl)
{
ResetError();
iStatus = ::SQLColAttributes(m_hStmtHdl,(UWORD)iColumnNum,(UWORD)SQL_COLUMN_LENGTH,(PTR)caDummy,(SWORD)1,(SWORD *)&iDummy,(SDWORD *)&lColWidth);
if (iStatus != SQL_SUCCESS && iStatus != SQL_SUCCESS_WITH_INFO)
UpdateDBError();
}
else
NoActiveStatement();
return lColWidth;
}
int DBStatement::GetNumCols()
{
short iStatus;
short iRetval = -1;
if (m_hStmtHdl)
{
ResetError();
iStatus = ::SQLNumResultCols(m_hStmtHdl,(short *)&iRetval);
if (iStatus != SQL_SUCCESS && iStatus != SQL_SUCCESS_WITH_INFO)
UpdateDBError();
}
else
NoActiveStatement();
return (int)iRetval;
}
|
|
|
|
|
The point being that you can develop a generic function to return your metadata using the SQLColAttributes ODBC call.
|
|
|
|
|
Hi guys
Somebody knows how to add the tooltip feature to the CLabel class that is here in Codeproject (SledgeHammer did this class). I've tried a solution but it doesn't work.
Best Regards
Dr.Pi
|
|
|
|
|
Hi guys
I've got an SDI app and from the View window I call a Modal Dialog.
When this dialog opens, the underneath view is not refreshed (all text is unreadable).
What I have to do to repaint the view meantime I am in the modal dialog?
Best Regards
Dr.Pi
|
|
|
|
|
One solution is Invalidate().
Kuphryn
|
|
|
|
|
I've got the same thing with one of my SDI apps, but it works fine. What styles are you using to create the dialog with?
|
|
|
|
|
Hi David
My styles are
Style : Child
Border : None
Nothing more checked in this dialog.
Hi Kuphryn
Where I have to put the Invalidate() meantime I am in the modal dialog?
Bsst Regards
|
|
|
|
|
Just for grins, change the style to Popup and see what happens.
|
|
|
|
|
Hi guys
I've discovered part of the problem.
I'm using CLabel class and when is repainted when the modal dialog is open the values are centered instead that left aligned amd made me thing that I had a repaint problem.
I don't know where could be the problem. I'll try to find.
Thanks
Dr.Pi
|
|
|
|
|
It sounds like you are using a CListView. If that is the case, you can change the alignment (e.g., LVCFMT__LEFT) when you are adding the columns.
|
|
|
|
|
I'm searching for an example of how to detect all the cameras and scanners attached to a PC (preferably serial and USB but I'll settle for USB only) I've tried using the STI and WIA apis, and those work, but there are two problems. One, they each support only a couple of OS versions, and I'd like something that works 98 through XP. Two, they only detect devices that export a TWAIN interface.
I want to get the name of each device. I did find some code that walks the USB bus, but there didn't seem to be a way to distinguish among returned devices.
Is there a good way to accomplish this that would work for Win 98 and on? Thanks.
|
|
|
|
|
|
Ryan S Roberts wrote:
You can use directshow to enumerate AV capture devices(If their drivers are WDM complient.)
It also finds VFW Devices
|
|
|
|
|
I am trying to overide some functions in CPropertySheet. I created a CPropertySheet derived class and added it to my project. when I do this in the main program, everything is cool:
//in main.cpp
CMyPropertySheet m_sheet(IDS_CODE);
m_sheet.AddPage(&entry);
m_sheet.AddPage(&approach);
But if I delare the object in the header, like this I get errors:
//in main.h
CMyPropertySheet* m_sheet;
//in main.cpp
m_sheet = new CMyPropertySheet(IDS_CODE);
m_sheet.AddPage(&entry);
m_sheet.AddPage(&approach);
Errors I get are:
error C2228: left of '.AddPage' must have class/struct/union type
I am assuming that the error is in the way I am trying to declare the CMyPropertySheet object, but I cant think of any other way. What am I doing wrong?
Kevin Shaffer
kshaff03@msn.com
|
|
|
|
|
in the first way you use directly an object, and in the second method you use a pointer to an object...
Then your problem should be solved by changing m_sheet.AddPage(&entry); for m_sheet->AddPage(&entry);
it's an usual mistake...
take a look at the error: error C2228: left of '.AddPage' must have class/struct/union type if what is in the left of the member (method, function or variable) is a class, a union or a struct you will need the "." elsewhere you'll need the "->".
hope this helps.
|
|
|
|
|
Got it, thanks!
I learned all of my object-oriented programming in Java, still trying to work out all the subtle differences. Thanks.
Kevin Shaffer
kshaff03@msn.com
|
|
|
|
|
That happens to all of us... subtle differences are evil!
you are welcome!
|
|
|
|
|
This question concerns the VS 6.0 IDE environment.
I am working on a rather large project. One convenient thing is that
a separate (console) project contains several classes that we wish to
use in the larger project. Therefore we are looking for a way to (easily)
import these (console) classes into the larger project (SolverGUI).
Can I create the new project (call it SolverGUI) using the MFC appwizard and then go to Project-Insert Project into Workspace and insert the console project into the SolverGUI project? This is possible, I know, but after doing that, can I use the classes in SolverConsole in SolverGUI? Is it as simple as declaring the header files in SolverGUI where I want to use the console classes, or do I have to add new classes to SolverGUI to use them?
ie: Is communication between projects possible?
|
|
|
|
|
Sounds like you need to wrap the common classes between the console/GUI app into a library or DLL. You can then build this and get your console/GUI versions to link to the lib/dll. This should also keep both projects upto date with the common code base, as changing one, changes the other.
Inserting a project into the current workspace only lets you switch between them. You can set build dependencies so that everything gets built in the right order etc.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|