|
Try this:
mylistctrl.SetExtendedStyle( mylistctrl.GetExtendedStyle() | LVS_EX_FULLROWSELECT ); HTH,
Thomas
I am a signature virus!
Help me spread and copy me to your sig!
|
|
|
|
|
That depends entirely on which version of the common controls you're using.
If you can guarantee (or at least require) that they install IE4 first, then you can use the LVS_EX_FULLROWSELECT style, but if it has to run on even the first version of Windows 95 without upgrades, then you must create an owner drawn listbox.
|
|
|
|
|
Does CoCreateInstance have a timeout feature? If my server is unavailable this call can take up to 2 minutes to return an error. I would like to return an error within 5 seconds or so.
Thanks
|
|
|
|
|
i would imagine the timeout is the network timeout for an unavailable resource as opposed to the cocreateinstance timeout ... as far as i know there is no way to speed up the os finding out what connections are or arent available ... if anyone knows better please correct me 'cos i'd love to know too
mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them
|
|
|
|
|
Hi Brenda & Lauren,
I too have had this problem and found that there was an INBUILT timeout! I am led to believe that it can be configured in the registry but did not bother to investigate it as it would be set for ALL CoCreateInstance calls not just mine. So my evil hack was to write my own CoCreateInstanceWithTimeout call which creates the object in a separate thread which I can then use as an arguement to WaitForSingleObject. (Threads send a signal upon termination)
The trick was to recognise that the caller had already timed out and to release the object cleanly watching for race conditions.
Sorry I couldn't be more helpful.
Jules
|
|
|
|
|
Actually the thread idea sounds great, Ill try that.
Thanks alot!
|
|
|
|
|
I have not been able to find any articles on calling VB dlls from VC++ to return an array of VB string data.
Ive seen some code using SafeArrays for a C++ dll with a VB client but not vice-versa.
Is arrays the most efficient way of returning lots of data from VB at one time?
Thanks
|
|
|
|
|
first ... arent i doing my duty as a helpful developer
second ... calling a vb dll from c++ ... hmmm ... why not write the dll in c++?
third ... when i call dll's that have to return a lot of data and i have some idea of the upper limit to the size of data returned i tend to alloc the memory from the caller and pass a pointer into the dll ... dunno if this is the 'right' way to do it but it works for me
again if anyone can correct me please do
mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them
|
|
|
|
|
Hi Brenda,
I agree with Lauren in that it seems odd that you want to write your DLL's in VB to be used by C++, esp are effiency is a concern. However you are going
to have to use VB friendly types and this means SAFEARRAYS. In C++ they are a
bit of a pain in the rear but MSDN has a pretty good description about it.
Personally I would use a COM comformant array. In MSDN bring up the size_is
page and look at Proc6(..) & Proc7(...), but again use VB friendly types.
L: I agree with passing the address of a local array but of course only if I know the upper bound.
Jules
|
|
|
|
|
The DLL's are written by VB guys and one of the clients is using VC++, another client is the web.
Here is the source and Im getting 32 elements supposely returned by how would I access the string values of the array? Or is this code all screwed up?
VB6.0 COM DLL Code:
VBTest.cls
Public Function GetArray(ByVal s As String) As Variant
Dim retArray(32) As Variant
For i = 1 To UBound(retArray)
retArray(i) = "V" & CStr(i)
Next
GetArray = retArray
End Function
VC++ 6.0 Source:
test.idl
interface _clsTestCPP : IDispatch {
[id(0x60030000)]
HRESULT GetArray(
[in] BSTR s,
[out, retval] VARIANT* );
test.cpp
void main()
{
// Declare an HRESULT and a pointer to the clsVBTestClass interface
HRESULT hr;
_clsTestCPP *IVBTestClass = NULL;
// Now we will intilize COM
hr = CoInitialize(0);
// Use the SUCCEEDED macro and see if we can get a pointer
// to the interface
if(SUCCEEDED(hr))
{
hr = CoCreateInstance( CLSID_clsTestCPP,
NULL,
CLSCTX_INPROC_SERVER,
IID__clsTestCPP,
(void**) &IVBTestClass);
// If we succeeded then call the GetArray method,
// if it failed then display an appropriate message to the user.
if(SUCCEEDED(hr))
{
long ReturnValue;
_bstr_t bstrValue("Hello World");//dummy
SAFEARRAYBOUND rgsa[] ={32,0};//CAN I DO THIS AFTER GetArray() and dimension?
SAFEARRAY* pTempArray = SafeArrayCreate(VT_VARIANT, 1, rgsa);
VARIANT vArray;
//call Visual Basic function
hr = IVBTestClass->GetArray(bstrValue, &vArray);
// Get a pointer to the elements of the array.
HRESULT hr = SafeArrayAccessData(pTempArray, (void **)&vArray);
if (FAILED(hr)) return;
// Check dimensions of the array.
if (SafeArrayGetDim(pTempArray) != 1)
return;
// how many elements are there in the array - does return 32 elements
long lElements=(pTempArray)->rgsabound[0].cElements;
for (int j = 1; j < lElements; j++)
{
// NEED TO ACCESS STRING POINTERS
}
SafeArrayUnaccessData(pTempArray);
hr = IVBTestClass->Release();
}
else
{
// Something went wrong
cout << "CoCreateInstance Failed." << endl;
}
}
// Uninitialize COM
CoUninitialize();
}
|
|
|
|
|
VB Code:
Function GetArrayStr(ByRef retArray() As String) As Long
On Error Resume Next
ReDim retArray(32) As String
For i = 1 To UBound(retArray)
retArray(i) = "V" & CStr(i)
Next
GetArrayStr = 1
End Function
// set up our array size
SAFEARRAYBOUND rgsa[] ={32,0};//32 elements
SAFEARRAY* pTempArray = SafeArrayCreate(VT_BSTR, 1, rgsa);//1 dimension
//call our vb function
hr = IVBTestClass->GetArrayStr( &pTempArray, &ReturnValue);
BSTR bstrCurrent = NULL;
// get the number of elements in the array
long lElements=(pTempArray)->rgsabound[0].cElements;
// iterate through our array elements
for (long j = 1; j < lElements; j++)
{
// get our array element
hr = SafeArrayGetElement(pTempArray, &j, &bstrCurrent);
if(FAILED(hr))
break;
char *c = ConvertToAnsi(bstrCurrent);
cout << "The string is: " << c << "." << endl;
}
|
|
|
|
|
is there a list of windows messages in numeric order or a way to find out which message corrosponds with number 15?
|
|
|
|
|
ummmm
do you mean error messages or notification messages?
windows.h and the connected header files will define all message numbers so have a root around in there maybe
mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them
|
|
|
|
|
You can look up window messages in the VC debugger. Run your app in debug mode (F5), go to the Watch window, and enter "15,wm" in the Name column. The ",wm" means show the number as a window message. In this case, it'll show WM_PAINT.
--Mike--
http://home.inreach.com/mdunn/
"That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."
--Buffy
|
|
|
|
|
hehe
you see ... i knew there were people out there who know more than me ... thank god
mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them
|
|
|
|
|
hi guys
am writing an app that needs to browse through the windows address book (ala outlook express) but have gotten nowhere in finding the file format it uses ... i couldnt find any com objects that give a search facility either ... any clues ?
help appreciated
|
|
|
|
|
I have a CBitmap and I need to write it to a file on the harddrive. Does anyone have a function to do this?
|
|
|
|
|
Both codeproject and codeguru have example projects for doing this. If you want something more in depth ( jpeg/tif/tga/etc), go to www.paintlib.de
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Merry Christmas to all members from Simi, I m lkn for a script which can help me to retrieve directory information and root folder of a ip address or a url. i made in vb but it only searches my local drive of computer but not on the net. plz let me know if you have any part of the code and then i can try to develop more . i think i read it somwhere most of the developers have used c++ for this script but i not sure. i guess this is the code which most of the robot spiders are using. i came across asptear but they don't provde source for their .dll, it doesnt work properly. if you come across any articles pleez let me know.any direction will be appreciated as i m stuck and don't have any idea where to go.
Merry Christams
Simi Vij, Chicago
|
|
|
|
|
i think VC++ is very difficult or poor comarable with VBasic & Delphi
in improving the user interface , such as :
-change the back ground color of a dialog box ?
-put an image as background ?
-or change the colors of the main bar(caption bar)?
is it really difficult or there is some easy way to reach that?How?
|
|
|
|
|
Nothing is dificult about changing the user interface as long as
you know where to look in the MFC help
the background color of a dialog can be easily changed in
WM_CTLCOLOR
look for CWnd::OnCtlColor in the help.
MFC is not as easy as VB and Delphi but it gives you more control over
your application
|
|
|
|
|
In your CProjectApp.cpp do:
SetDialogBkColor(RGB(0,0,0));
This would change the dialog background to black
To use an image you can use BitBlt.. if you need help with it let me know
|
|
|
|
|
BUT is it possible to do the same using WTL (no MFC) .. how ??
|
|
|
|
|
Any one know how to get rid of the Hor Scroll bar and Vertical Scroll bar in a Single Document??? You know how when it automatically put the scroll bar for you???But in this case I don't want any of it so anyone know how can I get rid of it??? Please help
|
|
|
|
|
Look in your view class's header file and see if you are deriving from CScrollView.
If so, change to derive from CView instead.
You may have to clean up some functions that no longer apply -- the compiler will let you know.
|
|
|
|