|
How to write socket and database programs in vc++ using MFC
can you give good source web sites for writing socket and database programs
thanks
prabhakar
|
|
|
|
|
|
I want to add the scripting facility to my MFC application.Please
suggest some tools , to develop my own c++ scripting codes.The
code should should interact with the vc++ environment well.
ditty grail
|
|
|
|
|
|
Hi,
please consider this article:
[^]
It rocks.
Hope this helps,
Andrea
|
|
|
|
|
I know we cricticalsection can accessed within a process which created it. But Mutexes can be accessed from a different thread even if its on a different process than which created it.
But wot about semaphores and events. Can they be accessed from different process than which created them ? Please throw some light.
Thanks in advance
|
|
|
|
|
|
AFAIK, Critical sections are the only process specific synchronization mechanisms in Windows. Everything else, which includes semaphores and events, are kernel level synchronization mechanisms and therefore can be used across multiple processes.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I want to change the StatusBar information dynamicly when my mouse on the menu item. which message should me response?
I love you not for whom you are, but who i am when I'm by your side
|
|
|
|
|
What "StatusBar information?"
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
The message displays on the statusbar when my mouse focus on the menu item
I love you not for whom you are, but who i am when I'm by your side
|
|
|
|
|
Is this an MFC application?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
yes
I love you not for whom you are, but who i am when I'm by your side
|
|
|
|
|
This is handled automatically with an MFC application. The only requirement is that you need an entry in the stringtable that matches the menu ID.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
The only requirement is that you need an entry in the stringtable that matches the menu ID
...............
To modify the string table can change the message staticly.
Is there a way to change the strings dynamicly that match with the menu id before displaying on the StatusBar?
I love you not for whom you are, but who i am when I'm by your side
|
|
|
|
|
gohappy_1999 wrote:
Is there a way to change the strings dynamicly that match with the menu id before displaying on the StatusBar?
This defeats what MFC is giving you for free. Why circumvent that? It is coded to look in the stringtable for a resource having the same ID as the menu item.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I have encountered a problem when i try to access database built on a remote server...
but when i tried accessing database on my local computer, this problem did not occur...
Anybody know how to solve this problem?
|
|
|
|
|
It would make this question much easier to answer if you could at least post the error you get when you try to access the database. But if I have to guess, I would think that you are using the default service account. That account doesn't have rights to access the network, instead you should create a user with normal user rights, and use that user with your service.
Magnus
|
|
|
|
|
But i have used this account in many normal applications(not service) to access the database already, it works fine. Does that mean it should not be because the account does not have the rights to access the network?
I will try to add in a normal account, and feedback here~ thanks so much~
|
|
|
|
|
And the reason why i did not provide the error message here is because it is a runtime error, no information in detail given!
|
|
|
|
|
From your service running under the system accoun, you can impersonate a user who has permission to access the database:
HANDLE token = NULL;j
if (LogonUser(szUser, szHostName, szPassword, LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, &token))
{
if (!ImpersonateLoggedOnUser(token))
{
CloseHandle(token);
token = NULL;
}
}
and then to revert to the system account:
if (token)
{
RevertToSelf();
CloseHandle(token);
}
|
|
|
|
|
Sorry,what does this mean? Does that means i need to impersonate an account to have the permission to access the database before connection?
|
|
|
|
|
I want to create a DLL in C++/VC++.
This dll will be called from C#.
How i will create it and how i will pass C++ structure as a parameter to my function.
|
|
|
|
|
--Your C++ code would look like the following
typedef struct St
{
int a;
int b;
}
__declspec(dllexport) void SetMyStruct( St* s );
--Now, in your c# code you would do the following:
[System.Runtime.InteropServices.LayoutKind(LayoutKindSequential)]
public struct St
{
public int a;
public int b;
}
public class MyClass
{
[DllImport("mydll.dll")]
public static extern void SetMyStruct( ref St s );
}
I hope this helps.
Human beings were not meant to sit in little cubicles staring at computer screens all day, filling out useless forms and listening to eight different bosses drone on about about mission statements. -- Peter Gibbons
|
|
|
|
|
Hoping someone can direct me to a solution on this. I have developed a pretty basic Client/Server system using Winsock2 using TCP (aka SOCK_STREAM)and when the client application of our system is installed and run on XP Pro, the application fails to open the socket when calling WSASocket. This has happened on two different machines. This problem does not occur on XP Home nor on Win2K Pro. Both of the problem machines have been upgraded to SP2.
Here is the code:
Socket = WSASocket (AF_INET,
SOCK_STREAM,
IPPROTO_TCP,
NULL, // LPWSAPROTOCOL_INFO lpProtocolInfo
0, // GROUP (reserved)
0); // DWORD dwFlags
This call in XP Pro returns INVALID_SOCKET and a subsequent call to WSAGetLastError() returns 0 which means it was successful. Hogwash. Need help on this.
Thanks,
Mike
|
|
|
|