|
define some intrface in windows service, that will act as out of proc COM server.
|
|
|
|
|
prasad_som wrote:
define some intrface in windows service, that will act as out of proc COM server.
Sorry if I sound rude , What if Service is win32/mfc based...?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
then whats problem? May be i didn't get your question.
|
|
|
|
|
prasad_som wrote:
y be i didn't get your question.
Actaully i want to say how will Win32/MFC based Project Expose Interface!!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Mojtaba_Service wrote:
Now,What do I do in this application:
The application request from windows service to return a specific inedx of array
Interprocess communication would be only solution to your problem.....
here is link:-
Inter Process Communication[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
i want to chang the data of VT_DATE to the one of VT_BSTR with the VariantChangeType function, but only a part of the data is changed. for example,2005-12-20 0:00:00 is converted to 2005-12-20 of VT_BSTR, but 1899-12-30 21:30:00 is converted to 21:30:00 of VT_BSTR. both 2005-12-20 0:00:00 and 1899-12-30 21:30:00 are from sql server, and 2005-12-20 0:00:00 is smalldatetime; 1899-12-30 21:30:00 is datetime. how can i get the complete VT_BSTR data?
|
|
|
|
|
How do I lock a file pointer (FILE *) in MSVC? On Linux, this is achieved via flock(). In Visual Studio 2005, there's _lock_file() and _unlock_file(), but I can't fine any function in VS2003. So how can I implement file locking? I don't want to use LockFile(), as I already have all the functions implemented using stdio instead of windows file managment.
|
|
|
|
|
Use _fsopen() if you wan't to lock the entire file. It returns a FILE *, just as fopen().
-- modified at 6:03 Wednesday 14th September, 2005
|
|
|
|
|
Thanks for your reply, but I don't want to fclose the file afer each fread/fwrite. In fact, there will be multiple threads and processes trying to access the file, so each one needs to lock the file first.
|
|
|
|
|
Hello.
I understand your problem. Another way to do it is to use sopen() and lock(). But then you have to use handles instead of FILE *. But if that's not a big deal, check it out. lock() can lock regions of a file.
|
|
|
|
|
I am wondering why this code works:
<br />
<br />
#include <windows.h><br />
#include <tchar.h><br />
#include <stdio.h><br />
#include <stdlib.h><br />
#include <winreg.h><br />
<br />
int main(int argc, char *argv[]) <br />
{<br />
<br />
<br />
HKEY hk, hk2; <br />
DWORD dwData, dwDisp; <br />
TCHAR szBuf[MAX_PATH]; <br />
<br />
<br />
_snprintf(szBuf, sizeof(szBuf)-1, "SOFTWARE\\Microsoft"); <br />
<br />
<br />
if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, szBuf, <br />
0, NULL, REG_OPTION_NON_VOLATILE,<br />
KEY_READ, NULL, &hk, &dwDisp)) <br />
{<br />
printf("Could not create the registry key."); <br />
return FALSE;<br />
}<br />
<br />
<br />
if (RegCreateKeyEx(hk, "Windows", <br />
0, NULL, REG_OPTION_NON_VOLATILE,<br />
KEY_WRITE, NULL, &hk2, &dwDisp)) <br />
{<br />
printf("Could not create the registry key."); <br />
return FALSE;<br />
}<br />
<br />
<br />
LONG retValue = 0;<br />
if ((retValue = RegSetValueEx(hk2,
"TestWrite",
0,
REG_EXPAND_SZ,
(LPBYTE) "data",
(DWORD) (sizeof("data")))))
{<br />
printf("Could not set the value., error=%d", retValue); <br />
return FALSE;<br />
<br />
}<br />
<br />
<br />
<br />
return 0;<br />
}<br />
1. I was expecting RegSetValueEx to fail as the key "SOFTWARE\\Microsoft" is opened with KEY_READ. Is it not the case that RegCreateKeyEx succeeds only if the samDesired parameter is only a subset of the one its parent key object is created with?
2. I need to write a registry wrapper class that prevents writing to HKLM. Does any one have ideas what is the way to go about it? I was planning to clear off the (KEY_CREATE_LINK|KEY_CREATE_SUB_KEY|KEY_SET_VALUE) bits before calling RegCreateKeyEx when the key is HKLM but any RegCreateKeyEx opening any sub key doesnt seem to inherit the access mode of its parent. Appreciate any ideas in this regard.
Thanks in advance.
~f
|
|
|
|
|
I want to transfer files(binary/text etc) from a client to the server and vice versa in VC++(MFC). Can anyone suggest the most efficient way to do it.
Thanks.
|
|
|
|
|
What about socket & TransmitFile
|
|
|
|
|
What about socket & AcceptEX & TransmitFile
|
|
|
|
|
|
PGiri wrote:
I want to transfer files(binary/text etc) from a client to the server and vice versa in VC++(MFC). Can anyone suggest the most efficient way to do it.
Sockets only reliable and efficient way to transfer the file between two client ( TWO ClIENT ONLY...) other wise you have to use HTTP/FTP technique
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hello,
Define efficient! If you mean that you wan't to transfer files as fast as possible, I cannot help you.
If you mean that your application doesn't block when you send the file, try multithreading and asynchronous IO.
You can aslo try IO Completion Ports. Do a search here on CP for IOCP and you'll get plenty results.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
This has to exist, but I cannot find it.
I want to know if there is a VS feature to allow me to quickly navigate in my Class Browser. All of you know that when you click on a method in class browser, the tool takes you to the source code... fine.
I want to go the other way. Given a location in the editor, I want VS to open up and position the class browser appropriately. If you are familiar with VS Help, you can open a help topic and then press Locate to access the current location in the TOC.
Ideas?
C. Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
|
|
|
|
|
I think cab file usage comes very often. Do you have any suggestions on 'what compression utility or tool to use which can be maintained inside a program'? could it be zip files or something else?
|
|
|
|
|
Google[^] tells me there's a cab SDK.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I think that's the cabinet sdk from microsoft. These are the FCI and the FDI. But it's very hard to incorporate these functions in your program especially if your a beginner like me. Though I tried to incorporate these functions into my program but I ended up in an 'unexpected end of file' error after a lot of editing just for these functions to work on my program in Visual C++. I guess i'll just have to trash the idea of using cab files and try to look for other file compression format
|
|
|
|
|
How will I declare a global variable in VC++? I have created a struct on one of my class (lets say class1) after the #include.... It was included in the Global folder in the class view tab but when I'm going to access it on a different class (class2), the error is "undeclared identifier". I've tried to put the struct on the header file of class1 but a linker error occured. How will i be able made a struct be accessible by all of my classes? Thanks, I'm really stuck
|
|
|
|
|
You can put your definition of your structure in any header file. To create a global variable for your struct, you can declare it in a source file. When you need to access this in another file, declare it again but with the extern keyword. E.g.
struct MY_STRUCT {
...};
#include "File1.h"
MY_STRUCT myStruct;
#include "File1.h"
extern MY_STRUCT myStruct;
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
|
|
|
|
|
I thought redeclaring the struct will reset all its values or perhaps reinitialize them.
|
|
|
|
|
Hello...
benjnp wrote:
I thought redeclaring the struct will reset all its values or perhaps reinitialize them.
No, only without the extern keyword... With the extern keyword you can declare global variables over many files without to reset them... They will be all associated to the first declaration...
|
|
|
|