|
i was under the impression that i had to use BSTR for all parameters and return values for Strings.. can i use char* as parameters and return values you think? or are you saying just for parameters and to still use BSTR as the return value?
thanks!
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
No, for the return type, you still have to use the BSTR type.
It's only for the parameters of your function that you can use the char*.
So, in C++, your function looks like that:
BSTR SomeFunction(char* String)
{
BSTR String = SysAllocStringByteLen(String,strlen(String));
return String;
}
And, the prototype in VB looks then:
Declare Function SomeFunction Lib "YourDll.dll" (ByVal Test As String) As String
Don't forget to include the "oleauto.h" file in your C++ file.
|
|
|
|
|
ya the char* is alot easier for me for parameters, thats what ive switched to, thanks for all the great help
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
This looks like a _UNICODE thing. Was your DLL developed on an NT machine with UNICODE defined as a command parameter? If so, a regular char will be two bytes wide instead of one byte.
See USESCONVERSION in the MSDN.
W2A - wide to ascii
A2W - ascii to wide
Also, look at 'TN059: Using MFC MBCS/Unicode Conversion Macros'
|
|
|
|
|
i am running win 2000, but i dont think i have unicode anywhere, im not really familiar with it, so i would assume im not using it.. i will look into it tho, seems to make sence..
thanks!
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
Error is in the signature, and marshaling assumption. According to your signature VB does not know how to manage the last parameter.
try the following
FindBankName(LPSTR strFilename, LPSTR strRoutingNumber, BSTR* a)
|
|
|
|
|
i hav a server which imitates the Windows I/o Completion port technology(for the 9x machines)by using WSASend() and WSARecv() functions
My problem is that , the Socket event which i get
is raised only when the time of fixed size is recived,
for eg: i send the packet of size 4k from cllient to server,
if the packet is exact 4k then the server scoket event raised and i can read the data, if the packet is 1k each, thatt event will not raised, that only raised when the 4k rached (4*iks), bcz of this i cantread the prev 3 packet datas..
Any solution?????
CodeTheDreams();
|
|
|
|
|
Hi
Here is my problem:
I have a Win32 application (no MFC) and want to allow the user to edit some options in a treeview inside a dialog.
But when the user edits an option in the treeview, the dialog closes as soon as a key is pressed.
The treeview has EDITLABELS on, it is possible to begin editing (TVN_BEGINLABELEDIT Notify is sent to the dialog) but as soon as an editing key (letters, numbers but not arrows)is pressed the dialog closes (TVN_ENDLABELEDIT is sent).
And the application doesn't close.
The solution is probably simple but I cannot see where the problem comes from.
Any help would be great.
Thank you in advance
Ben.
|
|
|
|
|
Hi,
How can setup MSVC++ 6.0 to automatically track which build I've created for my code so I can accurately track which is the latest build?
Such that build# =:
Build #0001 on the first compilation and
Build #0002 on the second compilation and so on and so forth.
I looked at the MSVC++ project settings tab 'Post-build step' and I haven't got a clue what to put there. Is there a place where I can find out information on how to use this feature?
Thanks a lot.
|
|
|
|
|
I saw something that might meet you needs here, haven't tried it myself though...
http://www.codeguru.com/devstudio_macros/build_number.shtml
|
|
|
|
|
After I've split a 24bit bitmap into 3 8bit channels (RGB), I want to display them using a grayscale 8bit bitmap.
Actually I set a 24bit pixel using th same value for R,G and B channel, in order to obtain 256 levels grayscale.
But it's so memory consuming!!!
I want to create an 8bit bitmap, how can I do that?
Thanks
|
|
|
|
|
HBITMAP CreateBitmapIndirect(<br />
CONST BITMAP *lpbm
);
in BITMAP structure you can set number of bits to 8
|
|
|
|
|
8 bit bitmaps are set up so that each byte in the image array is an index into a color palette having 256 RGB entries for that image. Your best bet would be to set each entry in the image's palette to a grayscale value.
For example:
If pPalette was a pointer to the palette for one of your 8bpp split bitmaps, then:
pPalette[0] = {0, 0, 0};<br />
pPalette[1] = {1, 1, 1};<br />
pPalette[2] = {2, 2, 2};<br />
...<br />
pPalette[254] = {254, 254, 254};<br />
pPalette[255] = {255, 255, 255};
Hope that helps a little.
-Mike Zinni
"No sh*t it's tough. If it wasn't, everybody and their sister would be an engineer and then you wouldn't have a job."
|
|
|
|
|
Hiya, I need to pass parameters to my OnEnKillfocus funtion.
This is what I have tried:
// class declaration
afx_msg void OnEnKillfocusRetrogroup2(long);
// function
void CGroupBranchRetro::OnEnKillfocusRetrogroup2(long overrider1)
{
// code
}
These are fine but it fails on my message map i.e
BEGIN_MESSAGE_MAP(CGroupBranchRetro, CDialog)
ON_EN_KILLFOCUS(IDC_RETROGROUP1, OnEnKillfocusRetrogroup1)
ON_EN_KILLFOCUS(IDC_RETROGROUP2, OnEnKillfocusRetrogroup2)
END_MESSAGE_MAP()
The error I get is:
error C2440: 'static_cast' : cannot convert from 'void (__thiscall CGroupBranchRetro::* )(long)' to 'AFX_PMSG'
Does anyone know how to pass parameters on OnKillfocus function properly??
Thanks,
grahamoj.
|
|
|
|
|
Where the value of that parameter should come from?
|
|
|
|
|
SendMessage(hwnd,WM_KILLFOCUS,(WPARAM)Wnd,0);
//simple as that ! use Cwnd->m_hwnd to get hwnd !
//rate me or hate me
I am the mighty keeper of the book on knowledge . Contact me to get your copy .
|
|
|
|
|
While using Sleep(0), I've noticed lag when the process context is switched to the next application. It seems almost as if Sleep(0) is causing the processor to thrash between apps. Maybe I'm just . I was wondering if any of you have noticed something similar? Also, other than thread priority is there a way to relinquish thread control?
Just as an afterthought. For a while I ran the United Devices Cure for Cancer app. I noticed that it kept the CPU pegged but I was never able to tell when the process context switched. I wonder what they used.
nay
|
|
|
|
|
Why are you using Sleep(0)? Why do you feel the need to stall the thread?
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Other applications are running concurrently. I do not want one to "hog" resources. From the MSDN Sleep(0) is what I want, but I'm not satisfied with the performance of it. I was just curious if there was another solution.
nay
|
|
|
|
|
If you have one thread that just wants to peg CPU,
use Sleep(50); ... Sleep(200);
|
|
|
|
|
Windows is a preemptive multi-tasker. It will periodically suspend your process to allow other things to run. If that isn't good enough for the thread in question, then force the priority of the thread to a lower level. Thus, if the use tries to work with practically any other window, they will be responsive.
There just isn't any justification for using Sleep on a real multi-tasking operating system. It causes excessive kernel transitions to do something that the OS is already designed to do for you.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Does anyone know if there is a limit in VC as to the number of controls you may place on a dialog? I know it sounds like a bizare dialog, but I have 255 controls on it, and am unable to place anymore. When I select a control from the palette and try to draw it on the dialog nothing happens. If I copy a control from the dialog and attempt to paste it, the paste button will not become active. I'm sure you're wondering why one would have so many controls on a dialog, it has 200 check boxes which display a status of a device and labels for groups of the check boxes. I need to have 25 more check boxes.
Does anyone know if 255 is the limit for the number of controls one can place on a dialog? I've exited and come back into VC, thinking maybe that would work, but no luck.
Any suggestions would be appreciated.
Thanks in advance,
Bob
|
|
|
|
|
I do not know, but it is easy to find out. Open your .rc file in notepad and add controls manually.
|
|
|
|
|
I believe the limit is in the GUI portion of the tool. It does appear to be limited to 255 controls. If I remove 3 controls, I can add only 3 more. I can however, add controls by manually editing the .rc and resource.h files.
Thanks for your input,
Bob
|
|
|
|
|
i wonder ! isn`t this because you have run out of space on it ?
I am the mighty keeper of the book on knowledge . Contact me to get your copy .
|
|
|
|