|
Sorry I did not get the rest of the info for you. I am behind on a very important deadline and I do not have a lot of time.
John
|
|
|
|
|
I know how to make a BSTR from a CString object but can't find the way to do the other way around.
Does anyone know how to create a CString object from a BSTR ??
|
|
|
|
|
Suppose you have :
BSTR b; // Allocate this by SysAllocString API
CString s;
then use:
s=b;
So simple.:-DOK It will work.
Regards,
Darshan Jani
|
|
|
|
|
Is this what you want ?
BSTR bstr = SysAllocString( L"abc" );
CString cs;
cs = bstr;
GuimaSun
www.nexsun.com.br
|
|
|
|
|
Hello,
At the moment I am outputing a bitmap on the screen and when it resizes etc. it redraws that bitmap ok. I need to output more bitmaps to the screen and when it need to be redrawn to display all of them. How can I do that? I tried double-buffering but I don't know how to add the "small" bitmaps to the off-screen bitmap.
Thanks
|
|
|
|
|
Hi,
I am trying to customize the CFileDialog. I want to have the select multiple files feature to turn on and off based on the user behavior (e.g. click a button on this customized dialog). Is it possible to do that ? I only know that it works only if I set the ofn flag to OFN_ALLOWMULTISELECT before intialize.
Thanks.
|
|
|
|
|
I'm not seeing that it makes any sense to ask the user if they want to select multiple files or not. Depending on the context in which files are selected, that feature should be determined by the program. What are the conditions that would toggle it one way or the other?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Actually the customize dialog will have 2 different sets of display. One of them only allows the user to select a single file, while the other one is intended to allow them to select multiple files. In both case the program will do some customize validation before opening the file(s). There will be a button for them to switch between the displays.
The reason i do this is because select multiple files won't allow work in different directories. I actually put a list box in this customize dialog to store the selected files such that when user browse to different directories, the previous selected files will not be lost.
|
|
|
|
|
benny2323 wrote:
The reason i do this is because select multiple files won't allow work in different directories.
I assume you know what folders are multiple-select and what folders are single-select before displaying the dialog. While you probably aren't allowing the button to switch to multiple-select mode when in a single-select folder, it doesn't make much sense to be in a multiple-select folder and have the button switch to single-select mode.
Realize that I'm making this observation based on the very little information that's been provided, but it just seems to stray too far from the (de facto) standard.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
My Service gets stopped when checked for dependensies through SCM.
ie, scm->rgt click->Properties->Dependencies
Then my CallBack function (for service stopping)gets called.
|
|
|
|
|
I get this linker error everytime I tried to create an instance of _variant_t,
I've check my project settings in case i miss any library.. but everything seems in order..
what did I miss ??
|
|
|
|
|
yanuart wrote:
what did I miss ??
Telling us what the linker error is.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
oh, that's okay I just include comdef.h and everything's fine
|
|
|
|
|
I'm trying to create a clients/server program, which only one server and lots of clients..
so I get the computer name using GetComputerName( ) as a server name pipe.
I had no problem creating name pipe when
lpszPipename = "\\\\.\\pipe\\mynamepipe";
but when I changed lpszPipename, it doesn't work..
LPCTSTR lpszPipename = "\\\\computer1\\pipe\\mynamepipe";
<br />
LPCTSTR lpszPipename = "\\\\computername\\pipe\\mynamepipe";<br />
<br />
HANDLE hPipe;<br />
<br />
hPipe = CreateNamedPipe( <br />
lpszPipename,
PIPE_ACCESS_DUPLEX,
PIPE_TYPE_MESSAGE |
PIPE_READMODE_MESSAGE |
PIPE_WAIT,
PIPE_UNLIMITED_INSTANCES,
BUFSIZE,
BUFSIZE,
NMPWAIT_USE_DEFAULT_WAIT,
NULL);
<br />
if (hPipe == INVALID_HANDLE_VALUE) <br />
{<br />
MessageBox("CreatePipe failed"); <br />
return ;<br />
}<br />
What am I doing wrong?
|
|
|
|
|
The MSDN says:
lpName
[in] Pointer to the null-terminated string that uniquely identifies the pipe. The string *MUST* have the following form:
\\.\pipe\pipename
I suggest you put your "computername" preceding the "pipename" name part.
GuimaSun
www.nexsun.com.br
|
|
|
|
|
The problem is that both server.exe and client.exe are communicating very well if and only if they both are on the same machine.
For examplle. there are 3 machines, c1,c2,and c3.
The server.exe is running on c2 and the client is running on each machine.
(note: both server.exe and client.exe are on the network drive.)
only the client on c2 is communicating with the server because to the client is on the same machine that the server.exe is running.
the other clients on c1 and c3 are not able to communicate with the server.exe.
Namepipe is used to commnunication between client and server.
CreateNamepipe(), "\\\\.\\pipe\\c2", is used by server.
CreateFile(),"\\\\.\\pipe\\c2", is used by client.
ReadFile() and WriteFile() are used to communication between client and server.
I thought I have to change the string ""\\\\.\\pipe\\c2", to "\\\\c2\\pipe\\c2", so client can find the server and talk. but I cant' even createNamepipe using above string ("\\\\c2\\pipe\\c2")
If I used the old string "\\\\.\\pipe\\c2" then client on the other machine can't find server.
what am i missing?
|
|
|
|
|
I am doing a multi threaded application that involves exchange of data.
ONE UI THREAD
AND 3 WORKER THREADS.PLS LET ME HOW TO EXCHANGE THE DATA BETWEEN THESE 3 WORKER THREADS.
FOR EX:THE FIRST THREAD WILL GIVE THE SECOND THREAD THE 2 NUMBERS AS ARGUEMENTS.the second thread should return the first thread the sum.
Pls help
YKUT
|
|
|
|
|
Use PostMessage() to communicate between them.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi there,
If I add a CArray such as CByteArray to a struct like so:
<br />
typedef struct DATAGRAM<br />
{<br />
CByteArray pkt_data;
} DATAGRAM;<br />
and then try and assign something of type DATAGRAM to type DATAGRAM i get the following compile error:
C2558: struct 'DATAGRAM' : no copy constructor available or copy constructor is declared 'explicit'
I know this is because because CByteArray is of dynamic type so I need to provide a copy constructor. So my question is do I need to provide one for DATAGRAM or do I really need to provide one for CByteArray and if so could somebody post a code snippet to help me out?
Cheers
Packetlos
|
|
|
|
|
isn't it because you use a struct instead of a class ?
i know C++ enlarge structures capabilities, but i wonder if that's possible...
TOXCCT >>> GEII power
|
|
|
|
|
You don't need to provide one for CByteArray if you provide one for DATAGRAM (that does not rely on CByteArray having a copy constructor)
|
|
|
|
|
Thanks toxcct and antlers,
toxcct was right that there in as far as I can see a way to provide a constructor for the struct, therefore I converted it to a class and used CByteArray's .Copy() to provide the assignment.
|
|
|
|
|
There is little difference between a class and a structure. The only difference is that the default protection is private for a class and public for a structure.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
that's what i was thinking, but in another side, i did never see struct with member functions...
so, here was my doubt.
TOXCCT >>> GEII power
|
|
|
|
|
Remember that a struct in C++ is a class that defaults to public access and a normal class defaults to private access. Since DATAGRAM has a dynamic member it does require a copy constructor:
struct DATAGRAM
{
CByteArray pkt_data;
DATAGRAM(DATAGRAM& dg)
{
pkt_data.Copy(dg.pkt_data);
}
};
Note: I did not use a typedef because it is not needed in C++.
Good Luck!
Now if the blasted power does not go out again, you'll get this message!
INTP
|
|
|
|