|
This will get all tables from access or any other
_ConnectionPtr pCon;
_RecordsetPtr pRs;
_bstr_t bstrTableType("TABLE");
_variant_t varCriteria[4];
varCriteria[0].vt = VT_EMPTY;
varCriteria[1].vt = VT_EMPTY;
varCriteria[2].vt = VT_BSTR;
varCriteria[2].bstrVal = mytable;
VARIANT varData;
SAFEARRAY FAR* psa;
SAFEARRAYBOUND rgsabound[1];
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = 4;
psa = SafeArrayCreate(VT_VARIANT, 1, rgsabound);
for( long lIndex = 0 ; lIndex < 4 ;lIndex++)
{
SafeArrayPutElement(psa, &lIndex,&varCriteria[lIndex]);
}
varData.vt = VT_VARIANT | VT_ARRAY;
V_ARRAY(&varData) = psa;
try
{
TESTHR(pCon.CreateInstance(__uuidof(Connection)));
TESTHR(pCon->Open(,"","",NULL));
pRs = pCon->OpenSchema(adSchemaTables);
while(!pRs->EndOfFile)
{
_bstr_t bsTableName = pRs->Fields->GetItem("TABLE_NAME")->Value;
pRs->MoveNext();
}
pRs->Close();
pCon->Close();
}
catch(_com_error e)
{
HandleComError(e);
}
Hope it helps
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
For Microsoft SQL, use the sp_tables_ex stored procedure.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
VARIANT v;
v.vt = VT_BOOL;
v.boolVal = 0;
Maybe this will work? You're initialisation of the VARIANT is not correct. If you want to place a boolean in your VARIANT, then set the type to VT_BOOL.
Er zit een korstje op mijn aars.
|
|
|
|
|
I tried with VT_BOOL.. still it doesnt work...
Also I tried declaring a function with same signature and that function call works but the one i am trying doesnt.....
Can u please tell me what can be the problem...
I am stuck from last 6 hours on this
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Two things. Firstly, you aren't initializing the variant properly, you've said it's a variant, but set the boolVal member.
Did you mean
vart.vt = VT_BOOL;
vart.boolVal = 0;
You don't specify which file/line the error occurs on. The message implies you are performing some kind of
dest = src;
where src is a VARIANT thing. If this is the case, you might be trying to assign the variant rather than one of it's union members.
Steve S
|
|
|
|
|
Hi Steve,
Yes I meant doing ---
vart.vt = VT_BOOL;
vart.boolVal = 0;
But even after doing that the error persists.
The error occurs at --
c.MemberFunc("hello", vart);
call
I know abt dest = src;
But steve I also tried writing another function with the same signature as
MemberFunc(...);
and passesd same parameters [ ie. NewFunc("hello", vart); ]
But the compiler gives no error for this call.
I am really confused
Help me out
modified 21-Apr-21 21:01pm.
|
|
|
|
|
I'm not exactely sure what the problem is, but perhaps you haven't initialised your VARIANT using 'VariantInit'. Don't know for sure if this is necessary though.
Er zit een korstje op mijn aars.
|
|
|
|
|
Hi, I've created an app which is using the CHtmlView.
When i create (from html)a window or html-dialog that covers part of the main CHtmlView and then closed - this region is not being re-painted.
I am trapping OnEraseBkgnd() which is notifying me that part of my background has been erased, but i don't know what to call to cause the RePaint.
I have tried InvalidateRect but this seems to blank the page completely.
Your help would be much appreciated
Carl
|
|
|
|
|
InvalidateRect is only half the process. This call tells Windows that a portion of the window should be repainted the next time a WM_PAINT message is sent to the window. In order to force an immediate repaint after one of the Invalidate* calls, you need to call UpdateWindow() .
Software Zen: delete this;
|
|
|
|
|
Gary Wheeler wrote:
InvalidateRect is only half the process. This call tells Windows that a portion of the window should be repainted the next time a WM_PAINT message is sent to the window. In order to force an immediate repaint after one of the Invalidate* calls, you need to call UpdateWindow().
tried the following with last parameter to Invalidate set to 0 also.
Just paints white over all html controls on the page. Can only get them to show by clicking mouse over each region
BOOL CTestEngine4View::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
//MessageBox("erase");
CRect rcClient;
GetClientRect(&rcClient);
InvalidateRect(&rcClient,1);
UpdateWindow();
return CHtmlView::OnEraseBkgnd(pDC);
}
|
|
|
|
|
Sorry; I didn't read your original post closely enough .
Take a look at this article[^] in the MSDN; it describes the problem you're experiencing, and how to fix it.
Side note: OnEraseBkgnd is called during the window painting process. As a result, calling InvalidateRect and/or UpdateWindow during that process would only confuse the issue. The window is in the process of being drawn, and you're telling it that the entire window needs updated, and then update the window (and Windows says "but I'm already updating it!")...
Software Zen: delete this;
|
|
|
|
|
thanks Gary - i found that OnErase gets called whenever another frame covers a region of an existing frame. By returning 'true' at this point the repaint works fine. (not entirely sure why)
However the article you pointed me too clears things up - thanks alot!
Carl
|
|
|
|
|
Hello
I need to developp an application which controls a card via USB port. Does someone have a good C++ class which defines the USB communication protocol?
Thank's for advance.
|
|
|
|
|
USB is not like serial port. You need kernel driver, or your device should support some standard protocol like HID to use built-in drivers. Check http://www.lvr.com/[^] for more.
|
|
|
|
|
Driver is ok. My device is well recognized by MS windows.
I just need to create a C++ usb class in order to define the communication protocol. Do you have more informations about this?
|
|
|
|
|
jeab. wrote:
I just need to create a C++ usb class in order to define the communication protocol. Do you have more informations about this?
How the device is recognized? Communication depends on device interface, there is no generic way. Many cards/monitor hardware with low traffic implements the hid interface. There you use read/writefile with specially constructed packets called reports. Each device defines its own report format. The link I gave has sample code.
|
|
|
|
|
The driver of the device was given with another application which works with.
I have to use the USB fonctionality of my device (which is controllable with a serial port RS 232) to control it by the application I have to adapt for.
I just want to know the functions I have to declare in my new CUsbCtrl class.
I see 3 functions (USBTxStart, USBTxDone, USBTxAbort) but I don't know how to make them.
|
|
|
|
|
I try your sample code but the file "hidsdi.h" is not given in your package.
|
|
|
|
|
It's not my code. This file is from windows ddk, you need it to compile.
|
|
|
|
|
You need the ddk to compile.
|
|
|
|
|
Hi,
Can anyone tell me how to find if a file is already open.This is to prevent two instances of the same file.
Thanks.
Deepak Samuel.
Deepak Samuel.
|
|
|
|
|
Try to open the file again. If it is opened elsewhere, you'll get an appropriate error.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I would add to David's comment - open the file with the EXCLUSIVE mode !!
'G'
|
|
|
|
|
Hello everyone,
I'm working on a project that involves texture mapping. The idea is that we want to see how the inside of an object looks like. So we have to make a crossection, the system already creates a bitmap of how the object would look like in the inside, but I need to texture map that bitmap on the crossection.
The problem is that the bitmap created still has some black borders and pieces in it. I want those colors to be transparant so that I can still see the rest of my object in 3D.
What I'm thinking of is the following. First we isolate the object inside the bitmap, take a rectangle region out of it and make the black color transparant. Now we've got a rectangle with our object inside of it without any black borders. Now we need to texture map that rectangle onto our object in 3D space. We need to calculate the a rectangle around our object in 3D space to texture map our bitmap to.
Can someone please help me.
I already found some good code for making the black color transparant.
Thanks in advance
zeno81
|
|
|
|
|
Hi There,
I continually find that I start implementing stuff then change my mind or handle some VC event and then decide that I actually what to handle anothe event and so end up with a whole pile of vc++ generated kludge. SO is there a tool that I can run so that I run the app run all the buttons and change all the parameters that I want and then after the app exists it wil colour code it. e.g. red code is not to be touched and blue code is code that hasn't been referenced or is safe to delete. E.g. do I really have to delete the ON_COMMAND_UI the afx mesage On command in the .h and the actual function in the C++ file if I change my mind for one menu item. Am imissing something is there a better way.
Do most people have a huge view class which has all the events they want to handle or do they put that in another class. Do most people actually keep the data not in the document but in the view in doc/view arch so they dont have to prefix all their data with GetDocument()
It seems to me that when changing menu ordering around or even changing a control on a dialog app that it requires a lot of work. How does everyone else do this? Does this mean that I need to design more carefully? Do other people have little test beds? I was thinking of having say a dialog app with buttons for each new test feature I want to add and then adding a class implementing that behavior so I can have little modules of the behavior that I want which I can then add them to the main module. Also do people here use CVS or do they actually use source safe which even MS does not recommened. If people use CVS then how do they cope with e.g. converting a class to a dll and cvs add and removing the correct folders and MS VC++ generated stuff? Why can I use dc->SetBkColor to change the background of most controls but I have to use OnEraseBkgrnd to change the colour of a view in a MDI/SDI app. (Why can't i Use SetBkCOlor for everything) Is having controls in a mdi view a bad idea since you have to manually calculate the offsets rather than a diaog app when you can just plonk them on? Do most people here actually know 5/6 languages inside out or do they only really know 1 or 2 really well. e.g. would people say they know MFC inside out or just subsets of it.
|
|
|
|