|
Excerpt from WriteFile documentation:
"If you are attempting to write to a floppy drive that does not have a floppy disk, the system displays a message box prompting the user to retry the operation. To prevent the system from displaying this message box, call the SetErrorMode function with SEM_NOOPENFILEERRORBOX."
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Hello All,
How to convert a variant, which is returned by vb dll that
actually contains a adodb.recordset, to recordet in vc++?
I casted it to IDispatch and to Recordset. But always I'm not getting
records. If I used recordcount, it's returning only -1.
Advance thanks for ur reply.
regards,
ramesh
|
|
|
|
|
You can convert the IDispatch to a _RecordsetPtr.
//mycontrol.h
_RecordsetPtr m_pRS;
//mycontrol.cpp
STDMETHODIMP CMeCTable::put_DataSource(IDispatch *newVal)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
if (m_pRS == NULL)
m_pRS = NULL;
HRESULT hr = newVal->QueryInterface(__uuidof(_RecordsetPtr), (void**)&m_pRS);
if FAILED(hr)
{
return E_FAIL;
}
}
|
|
|
|
|
Hi chenzhu,
Thank you very much for your suggestion. Even after using the QueryInterface also I didn't get the exact value from the GetRecordCount function. I got one reply such that it is because of the cursor type.
Now, I can traverse thru recordset by using Move functions. The only thing I couldn't able to get the records count and fields count. If any more solutions, let me know.
Thanking you,
regards,
Ramesh
|
|
|
|
|
Hi!
how to PtinLine Function?
Thanks.
|
|
|
|
|
You mean you want to know how to figure out if a point is in a given line ? I suppose you'd have to traverse it, or you could use a mask to check. It depends on what you're doing - i.e. how often you need to check and how quickly you need and answer.
Christian
I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in.
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|
|
Hello, I am not familiar with OpenGL and its API, but I was wondering how I would go about using the function glReadPixels()? Yes, yes, I have looked at all of the declarations for it as MSDN, etc., but I still am I not sure how to utilize it. In order to use the function, must I intialize a bunch of OpenGL things as I would for DirectDraw? How would I incorporate this function in a Win32 program that reads the color values of pixels in a game running in OpenGL? Also, once pixel data is retrieved, say with the GL_RGB flag (or any other one for that matter. I'm not too familiar in which mode to use), how do I access the color information of the pixels? Is it stored in hexademical, etc? If possible, it would to great to have example code showing how to use glReadPixels(). Thank you very much in advance.
-Helpless programmer
|
|
|
|
|
i'm no opengl expert but when you read a pixel from a display via a library call such as you are talking about there is usually another function somewhere in the lib that lets you get / set the pixel format (ie, a/r/g/b or a/b/g/r or whatever)
as for hexadecimal ... all numbers are the same regardless of the base encoding they use ... 0xff == 255 == 11111111b etc
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
This is an article about creating a jpeg out of OpenGL screen, (it uses glReadPixels)
http://www.codeguru.com/opengl/snaptojpeg.shtml
Jonathan de Halleux, Belgium.
|
|
|
|
|
|
On the shelves at your local Best Buy.
But seriously, call GetLogicalDrives() to determine the drive letters in use, then GetDriveType() on each drive. GetDriveType() returns DRIVE_CDROM for CD-ROM drives.
--Mike--
http://home.inreach.com/mdunn/
The Signature, back by popular demand: Buffy. Pajamas.
|
|
|
|
|
Thanks! Have a great weekend!
|
|
|
|
|
This is an example:
void GetCDROMDrive(void)
{
char buf[10];
BOOL bFind = FALSE;
for (int i = 0;i < 24;i++)
{
if (bFind)
break;
sprintf(buf,"%c:\\",'C'+i);
WORD type = GetDriveType(buf);
switch(type)
{
case DRIVE_UNKNOWN:
break;
case DRIVE_NO_ROOT_DIR:
break;
case DRIVE_REMOVABLE:
break;
case DRIVE_FIXED:
break;
case DRIVE_REMOTE:
break;
case DRIVE_CDROM:
//("CD-ROM");
lstrcpy(g_szCD_ROM,buf);
break;
case DRIVE_RAMDISK:
break;
default:
break;
};
}
}
welcome you to Sky...
|
|
|
|
|
Just a quick note about switch/case; if you've got this:
switch (x)
{
case 0:
break;
case 1:
break;
case 2:
MyFunction();
break;
case 3:
MyFunction();
break;
case 4:
MyOtherFunction();
break;
};
You can write it mroe concisely as:
switch (x)
{
case 0:
case 1:
break;
case 2:
case 3:
MyFunction();
break;
case 4:
MyOtherFunction();
break;
};
You probably already knew, but for the purposes of anyone reading it may be useful info.
> Andrew.
|
|
|
|
|
Does anyone know how to put an input box or dragdown menu on the toolbar???? I want to let someone to choose from the menu or type the command directly in the input textbox.
|
|
|
|
|
The usual method of doing this is to place a separator in the toolbar, make it pretty wide (200 px or so) and create your edit box as a child window of the toolbar, positioning it in the RECT of the separator.
Check out the docking window/toolbar section on this site, there should be an article dealing with this topic.
--Mike--
http://home.inreach.com/mdunn/
The Signature, back by popular demand: Buffy. Pajamas.
|
|
|
|
|
Hi all...
I've got an application that is running multiple regions. The application works fine, does what it's supposed to, updates take place, no memory leaks... all good stuff..
Problem is... if I run TaskInfo2000, it shows my GDI handles increasing as I make visual changes to the app.
I watch it with the debugger, and find that when I do pRgn->DeleteObject() followed by delete pRgn, and nothing happens to the number of handles. I know that TaskInfo isn't in error, because I can eventually run the app into the ground.
I've tried instantiating an HRGN, doing a detach to my HRGN, and an SDK DeleteObject on that, and it still doesn't do anything.
I might add that the regions are NOT selected into any device contexts or attached to any windows at the time they're being deleted.
Anybody seen this before, or any thoughts what the heck is going on?
Thanks for any thoughts...
Dave Campbell
Skinning Specialist
Touch Technology Int.
|
|
|
|
|
Hi !
"An application should not call DeleteObject on a CGdiObject object that is currently selected into a device context". Youd should unselect object from dc before deleting it.
Best regards,
-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor_soukhov@mailru.com | ICQ:57404554 | http://siv.da.ru
|
|
|
|
|
Thanks for your response, Igor, except I'll give you a quote from my posting:
"I might add that the regions are NOT selected into any device contexts or attached to any windows at the time they're being deleted."
Dave Campbell
Skinning Specialist
Touch Technology Int.
|
|
|
|
|
It seems to me as though it has nothing at all to do with the regions. Are you sure that the handle count is increasing when you are creating the regions. Also, remember when you use DC's you must do this;
void MyFunc( )
{
CPaintDC pdc(this);
CBrush b(RGB(0,0,0))
CBrush *pOldBrush = pdc.SelectObject(&b);
pdc.SelectObject(pOldBrush);
}
If you don't reselect the old pens, brushes etc. into the device context then they will not be deleted when their destructor is called.
Hope that helps,
Andrew.
|
|
|
|
|
I store an exe image in my program as a resource,then I load this block in the memory but now I want to execute this exe block wihout need to write it in exe file
|
|
|
|
|
Not too sure about this one, but (and I'm sure someone will verify the correctness of this for me) instead of doing what you said can you not just use ShellExecute with the 'res:' protocol?
> Andrew.
|
|
|
|
|
Ive found myself on more than one ocassion writing code in MFC which imlements a database query using a CRecordset, and churns through the records one at a time doing something to each record.
This type of operation is typically time consuming, and therefore I would like to present the user with a percentage complete indicator (Progress Bar).
My problem of course is that I dont know the size of the record set
a priori (GetRecordCount returns only the highest numbered record so far accessed). Of course I dont want to churn thru the record set before hand to determine its size.
Any ideas on an elegant way to attack this? Other ways to produce satisfactory progress feedback to the user?
Thanks very much in advance!
Dave Carkeet,
Santiago, Chile
|
|
|
|
|
Ok, so MoveLast before GetRecordCount is not an option. Seems that percentage is absolutely necessary you need to perform query with 'SELECT COUNT(*)' and identical WHERE clause before traversing the recordset. Of course, number of records could change between two queries in multi-user scenario, so value returned from first query should be treated with care. COUNT(*) can also be pretty expensive, depending on WHERE.
I don't know your exact requirements, but maybe it's enough to just display a message like 'Please wait, processed 19002 records so far...'.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
I have the following tree:
.ABC
.|_A
.|_B
.|_C
.XYZ
.|_X
...|_XX
.|_Y
.|_Z
I want to display something when i use a mouse to click on particular item. How to do that?
For example, if I highlight XX, then pop up a message box say "XX"....etc...
Thanks
|
|
|
|