|
i am working on windows services as my semester project. can any body tell me plz, how to call an .exe or .dll file from a service.
one more thing that what event is triggered when system is locked. (when we press ctrl+alt+del) i have found a function from MSDN lockworkstation() but this is not gonna work. i want to launch an exe file when user is logged on or lock or unlock the system. looking forward for any good suggestion.
thank u.
Nadir Ali
Student Information Technology
National University of Sciences and Technology
Pakistan
|
|
|
|
|
Csharper99 wrote:
...how to call an .exe or .dll file from a service.
How about CreateProcess() ?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
If you only have to run on WindowsXP or later, you are in luck.
Your service, after registering its service control handler function, should receive a control event of SERVICE_CONTROL_SESSIONCHANGE. This will pass a data structure with the information about what happened: log on, log off, session locked, etc.
From MSDN:"A HandlerEx function is an application-defined callback function used with the RegisterServiceCtrlHandlerEx function. A service program can use it as the control handler function of a particular service.
The LPHANDLER_FUNCTION_EX type defines a pointer to this function. HandlerEx is a placeholder for the application-defined name.
This function supersedes the Handler control handler function used with the RegisterServiceCtrlHandler function. A service can use either control handler, but the new control handler supports user-defined context data and additional extended control codes."
Also see this:"WTSSESSION_NOTIFICATION
The WTSSESSION_NOTIFICATION structure provides information about the session change notification. A service receives this structure in its HandlerEx function in response to a session change event."
Ticking away the moments that make up a dull day, I friter and waster the hours in an offhand way...
|
|
|
|
|
I like to change an ItemMenuBitmap with the CMenu::SetMenuItemBitmaps() function.
I have problem to display the correct bitmap. Usually a dot bitmap is displayed ( may be is the default bitmap of MFC ).
Below is the used code.
CBitmap bitMap ;
bitMap .LoadBitmap(IDB_BITMAP);
pPopup->SetMenuItemBitmaps(ID_MENU_ITEM1,
MF_BYCOMMAND,&bitMap, &bitMap);
|
|
|
|
|
Dont declare bitMap variable local . If you declare it out of the function that you wrote this code it work safe .
I wrote this code and work very well :
CBitmap m_CheckBitmap,m_UnCheckBitmap;
OnButton1()
{
ASSERT(m_CheckBitmap.LoadBitmap(IDB_BITMAP1));
// Associate bitmaps with the "Test" menu item.
CMenu* mmenu = GetMenu();
CMenu* submenu = mmenu->GetSubMenu(0);
(submenu->SetMenuItemBitmaps(ID_A_B, MF_BYCOMMAND,
&m_CheckBitmap, &m_CheckBitmap));
}
|
|
|
|
|
I like to change an ItemMenuBitmap with the CMenu::SetMenuItemBitmaps() function.
I have problem to display the correct bitmap. Usually a dot bitmap is displayed ( may be is the default bitmap of MFC ).
Below is the used code.
CBitmap bitMap ;
breadthBitMap.LoadBitmap(IDB_BITMAP);
pPopup->SetMenuItemBitmaps(ID_MENU_ITEM1,
MF_BYCOMMAND,&bitMap, &bitMap);
|
|
|
|
|
hey, guys
As we know that a commonly used PDF file maybe contains both the vector elements and raster elements.
If I want to transfer all of vetor elements to raster then what will I do?
I think that some API functions is neccessary, so who can show me them.
thanks all
|
|
|
|
|
|
You have to use a RIP (raster image processor).. There are several around... some cheap, some expensive.. some freeware. Have a look for an application called GhostScript... that'll do what you wnat to do.
|
|
|
|
|
hello all
im connecting to a ODBC datasource and im using
hr = cpDbCMIS->Open("DSN=CP_CMIS_CON;UID=STUD_ADMIN;PWD=STUD_ADMIN","","",-1);
to connect to it, this works fine when i already know the user name and password
but i need to connect to different databases, with different user names and passwords
which would be provided by the users, and then stored in CString variables
i want to use something like
CString CnnStr="DSN=CP_CMIS_CON;UID="+username+";PWD="+password+"";
hr = cpDbCMIS->Open(CnnStr,"","",-1);
but i cant get that to work can ne1 help at all
thanks
simon
|
|
|
|
|
try
CString tmp="DSN=EOP;UID="+name+";PWD="+pw;
m_pDatabase->OpenEx(tmp, CDatabase::noOdbcDialog );
|
|
|
|
|
thanks but that doesnt work either
i dont use OpenEx
it is an ado connection if that helps
simon
|
|
|
|
|
si_69 wrote:
but i cant get that to work
Why? What is the value of CnnStr after the assignment? It should be the same as the first value you've shown being passed to Open() .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
im a bit crap a c++
but if i use
CString CnnStr="DSN=CP_CMIS_CON;UID="+simon11+";PWD="+simon12+"";
hr = cpDbCMIS->Open(CnnStr,"","",-1);
then i get a complier error
error C2664: 'Connection15::Open' : cannot convert parameter 1 from 'CString' to '_bstr_t'
if i use GermanGeorge's example
CString tmp="DSN=CP_CMIS_CON;UID="+simon11+";PWD="+simon12;
cpDbCMIS->OpenEx(tmp, CDatabase::noOdbcDialog );
then i get the compiler error
error C2039: 'OpenEx' : is not a member of '_Connection'
|
|
|
|
|
How about:
hr = cpDbCMIS->Open(_bstr_t((LPCTSTR) CnnStr), "", "", -1);
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
superb, thanks
|
|
|
|
|
If I want to know the dependancies of IE patch ?how should I know?
where are these patch ids stored.
How should one come to know that a IE has patch?
How should one come to know that a machine has a patch?
|
|
|
|
|
Try
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\MinorVersion
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
can someone please tell me a way to gwet the IP of the localhost. A function or a way to receive it in a buffer.
I certainly hope you can help me.
And how can I get the ip of a computer in the localnetwork because in most cases you getr the ip of the Net provider of that whole local network.
Please adive at least with a function for the localhost.
Thank you
gabby
|
|
|
|
|
Check the NetWkstaGetInfo() from the Platform SDK! If this is not quite helpful, you may consider another API from the networking API in the PSDK!
* Don't wish it was easier, wish you were better! *
|
|
|
|
|
I wish I were better really I am really trying to get there
Thank you for the help
gabby
|
|
|
|
|
You can get a list of the interfaces in which you can get the IP address
WORD versionRequested;
int wsError;
WSADATA winsockData;
SOCKET s;
DWORD bytesReturned;
char* pAddrString;
SOCKADDR_IN* pAddrInet;
u_long SetFlags;
INTERFACE_INFO localAddr[10];
int numLocalAddr;
versionRequested = MAKEWORD(2, 2);
wsError = WSAStartup(versionRequested, &winsockData);
if (wsError)
return;
if ((s = WSASocket(AF_INET, SOCK_DGRAM, IPPROTO_UDP, NULL, 0, 0)) == INVALID_SOCKET)
{
WSACleanup();
return;
}
wsError = WSAIoctl(s, SIO_GET_INTERFACE_LIST, NULL, 0, &localAddr, sizeof(localAddr), &bytesReturned, NULL, NULL);
if (wsError == SOCKET_ERROR)
{
closesocket(s);
WSACleanup();
return;
}
closesocket(s);
numLocalAddr = (bytesReturned / sizeof(INTERFACE_INFO));
for (int i = 0; i < numLocalAddr; i++)
{
}
WSACleanup();
Hope that helps.
Ant.
|
|
|
|
|
thanks dude
that's cool
gabby
|
|
|
|
|
|
euacela wrote:
can someone please tell me a way to gwet the IP of the localhost.
Call gethostname() followed by gethostbyname() .
euacela wrote:
And how can I get the ip of a computer in the localnetwork...
Use gethostbyname() for this, too.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|