|
I think you are still stuck with the same problem . Why are you using CWaitCursor function? wasn't SetCursor() a better solution?
|
|
|
|
|
No it is good once but,SetCursor() was a working for all the dialogs except for one dialog box.
When I user CWaitCursor using this works for all the dialogs (for the one dialog which I mentioned above I used
wait.Restore(); inbetween the code).
It worked. But now the new problem was that when on mouse move event , the hour glass symbol is replaced by normal mouse cursor.
Is there some thing similar to wait.Restore(); wich I can use with SetCursor
|
|
|
|
|
ptr_Electron wrote: CWaitCursor changes back to normal cursor on mouse move event, before the end of the function
There is an option in to restore the cursor back, use CWaitCursor::Restore. Also check from where the cursor is being reset to normal cursor.
|
|
|
|
|
See here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi,
I need C or C++ code to convert the hex string to the binary string please can any one help me.
Eg Hex Data:
C1 E1 08 0F B6 C0 0B C8 8D 45 F4 50 89 4D F8 FF 15 48 70 40 00 83 45 F0 04 89 45 14 50 8D 45 E4 50 FF 75 0C FF 15 4C 72 40 00 FF 75 14 FF D3 83 45 E8 04 39 7D E8 0F 8C 77 FF FF FF 83 7E 58 FF 74 65 FF 76 34 FF 15 4C 70 40 00 85 C0 89 45 14 74 55 8B 7D 0C 6A 01 57 C7 45 E4 10 00 00 00 C7 45 E8 08 00 00 00 FF 15 50 70 40 00 FF 76 58 57 FF 15 54 70 40 00 FF 75 14 8B 35 58 70 40 00 57 FF D6 89 45 0C 8D 45 E4 68 20 08 00 00 50 6A FF 68 40 3F 42 00 57 FF 15 50 72 40 00 FF 75
To Binary Data:
Vÿq@ ‹ø;ûteÿuWÿq@ ‹ð;ót=9]ä‰]ütÿuäèéóÿÿÿÖ…Àt1ÇEü
ë(h @ h°@ h PB h ÿuøÿÖƒÄë
ÿuj÷èÊ, 9]èuWÿq@ ëjöëjçè™óÿÿSÿq@ é jðèó j߉EÐèé
|
|
|
|
|
Since your string is well formatted, it's pretty simple, for instance
char szHex[] = "C1 E1 08 0F B6 C0 0B";
const unsigned int SIZE = sizeof(szHex)/sizeof(szHex[0]) / 3;
unsigned char pBinary[SIZE];
for (int i=0; i<SIZE; i++)
{
if ( sscanf(szHex + 3 * i, "%2X", pBinary+i) != 1) break;
}
However, I see the result you're expecting is quite different. How can, for instance, you map 0xC1 to 'V' ?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
modified on Tuesday, June 9, 2009 3:32 AM
|
|
|
|
|
No i pasted just for a sample output that i need, its not the correct output i copied a part from the output,
Thanks for your post.
|
|
|
|
|
How would you do this using pencil and paper?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
hello,
i want to write a program in vc++ 2008 using win32 c which run on client and check the status of iis server. the status means ---- server is down or not, sql is working or not and iis is working or stopped.
please guide me
thanks
rahul
|
|
|
|
|
Can you check the IIS service on that remote machine?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
i dont know. i want to this project but i dont know much about it. i come to know that socket programming will be used for this project.
actually i am totally new to windows programming but i have to summit this project soon or i will in big trouble. i am trying my best to learn it but time is less, work is more. i will learn windows programming in detail after this project because then i will have more time.
|
|
|
|
|
rahuljin wrote: i will learn windows programming in detail after this project because then i will have more time.
Famous last words.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
really, i know basic of c, c++, java, html\xhtml, vb, etc. this is the frist time i am doing the advance level programming. i want to learn asp .net but not know.
|
|
|
|
|
rahuljin wrote: this is the frist time i am doing the advance level programming.
It's not really an advanced topic as much as it is a specialized topic. See here for an idea.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
thanks for the link. i have tried to write some code but it is not working. can u find the mistake i am making ? i want to find the status of the service "W3SVC", and when it is running, the program should print "Found" ----
<br />
<br />
#ifndef UNICODE<br />
#define UNICODE<br />
#endif<br />
<br />
#include <stdio.h><br />
#include <assert.h><br />
#include <windows.h><br />
#include <lm.h><br />
#include <tchar.h><br />
#include <wchar.h><br />
<br />
int wmain(int argc, wchar_t * argv[])<br />
{<br />
LPSERVER_INFO_101 pBuf = NULL;<br />
LPSERVER_INFO_101 pTmpBuf;<br />
DWORD dwLevel = 101;<br />
DWORD dwPrefMaxLen = MAX_PREFERRED_LENGTH;<br />
DWORD dwEntriesRead = 0;<br />
DWORD dwTotalEntries = 0;<br />
DWORD dwTotalCount = 0;<br />
DWORD dwServerType = SV_TYPE_SERVER;
DWORD dwResumeHandle = 0;<br />
NET_API_STATUS nStatus;<br />
LPTSTR pszServerName = NULL;<br />
LPTSTR pszDomainName = NULL;<br />
DWORD i;<br />
<br />
if (argc > 2) <br />
{<br />
fwprintf(stderr, L"Usage: %s [DomainName]\n", argv[0]);<br />
exit(1);<br />
}<br />
if (argc == 2)<br />
pszDomainName = argv[1];<br />
nStatus = NetServerEnum((LPCWSTR) pszServerName,<br />
dwLevel,<br />
(LPBYTE *) & pBuf,<br />
dwPrefMaxLen,<br />
&dwEntriesRead,<br />
&dwTotalEntries,<br />
dwServerType, <br />
(LPCWSTR) pszDomainName, <br />
&dwResumeHandle);<br />
if ((nStatus == NERR_Success) || (nStatus == ERROR_MORE_DATA)) {<br />
if ((pTmpBuf = pBuf) != NULL) {<br />
for (i = 0; i < dwEntriesRead; i++) {<br />
assert(pTmpBuf != NULL);<br />
<br />
if (pTmpBuf == NULL) {<br />
fprintf(stderr, "An access violation has occurred\n");<br />
break;<br />
}<br />
<br />
printf("\tPlatform: %d\n", pTmpBuf->sv101_platform_id);<br />
wprintf(L"\tName: %s\n", pTmpBuf->sv101_name);<br />
printf("\tVersion: %d.%d\n",<br />
pTmpBuf->sv101_version_major,<br />
pTmpBuf->sv101_version_minor);<br />
printf("\tType: %d", pTmpBuf->sv101_type);<br />
if (pTmpBuf->sv101_type & SV_TYPE_DOMAIN_CTRL)<br />
wprintf(L" (PDC)");<br />
else if (pTmpBuf->sv101_type & SV_TYPE_DOMAIN_BAKCTRL)<br />
wprintf(L" (BDC)");<br />
<br />
printf("\n");<br />
SC_HANDLE hSCM = OpenSCManager((LPCTSTR) pTmpBuf->sv101_name, NULL, SC_MANAGER_CONNECT);<br />
<br />
if (hSCM != NULL)<br />
{<br />
SC_HANDLE hService = OpenService(hSCM, _T("W3SVC"), SERVICE_QUERY_STATUS);<br />
if (hService != NULL)<br />
{<br />
SERVICE_STATUS ss;<br />
if ((QueryServiceStatus(hService, &ss) == SERVICE_RUNNING)||(QueryServiceStatus(hService, &ss) == SERVICE_START_PENDING))<br />
printf("Found");<br />
<br />
CloseServiceHandle(hService);<br />
}<br />
CloseServiceHandle(hSCM);<br />
}<br />
<br />
wprintf(L"\tComment: %s\n\n", pTmpBuf->sv101_comment);<br />
<br />
pTmpBuf++;<br />
dwTotalCount++;<br />
}<br />
<br />
if (nStatus == ERROR_MORE_DATA) {<br />
fprintf(stderr, "\nMore entries available!!!\n");<br />
fprintf(stderr, "Total entries: %d", dwTotalEntries);<br />
}<br />
<br />
printf("\nEntries enumerated: %d\n", dwTotalCount);<br />
<br />
} else {<br />
printf("No servers were found\n");<br />
printf("The buffer (bufptr) returned was NULL\n");<br />
printf(" entriesread: %d\n", dwEntriesRead);<br />
printf(" totalentries: %d\n", dwEntriesRead);<br />
}<br />
<br />
} else<br />
fprintf(stderr, "NetServerEnum failed with error: %d\n", nStatus);<br />
if (pBuf != NULL)<br />
NetApiBufferFree(pBuf);<br />
<br />
return 0;<br />
}<br />
<br />
<br />
|
|
|
|
|
rahuljin wrote: if ((QueryServiceStatus(hService, &ss) == SERVICE_RUNNING)||(QueryServiceStatus(hService, &ss) == SERVICE_START_PENDING))
printf("Found");
Should be:
if (QueryServiceStatus(hService, &ss) != FALSE)
{
if (ss.dwCurrentState == SERVICE_RUNNING || ss.dwCurrentState == SERVICE_START_PENDING)
printf("Found");
}
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
thanks, it is working now. i will bother u soon if i stuck in something.
one more thing i want to ask. currently i have only one computer so no network. will this program work on a network of computers too ? i cant check myself.
suppose i run it on a client, will it give the info of server or all the computers in the network (clients + servers) ?
also, if i have the ip address of the server then how to use it in this program ?
thanks again
rahul
update :
when i make a try to make a array of processes like this -------
wchar_t selPro[] = { _T("W3SVC"), _T("Iisadmin")};
SC_HANDLE hService = OpenService(hSCM, selPro[j], SERVICE_QUERY_STATUS);
where j is for "for" lool (0,1). when i compile this code, compiling completes without any error and when i try to run it, it crashes. if i pass without array, it works fine.
please guide me
modified on Saturday, June 13, 2009 5:05 PM
|
|
|
|
|
rahuljin wrote: will this program work on a network of computers too ?
That's what NetServerEnum() is for.
rahuljin wrote: suppose i run it on a client, will it give the info of server or all the computers in the network (clients + servers) ?
First, did you try it? Second, did you check MSDN to see how OpenSCManager() handles its first argument?
rahuljin wrote: also, if i have the ip address of the server then how to use it in this program ?
Convert the IP address to the host name using gethostbyaddr() .
rahuljin wrote: ...it crashes.
Meaning what? A "crash" is fairly meaningless.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
here is error from windows. it says "new01" has stopped working
Problem signature:
Problem Event Name: APPCRASH
Application Name: new01.exe
Application Version: 0.0.0.0
Application Timestamp: 4a349ab0
Fault Module Name: RPCRT4.dll
Fault Module Version: 6.1.7100.0
Fault Module Timestamp: 49eea681
Exception Code: c0000005
Exception Offset: 0002f3b0
OS Version: 6.1.7100.2.0.0.256.1
Locale ID: 16393
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
Read our privacy statement online:
http:
If the online privacy statement is not available, please read our privacy statement offline:
C:\Windows\system32\en-US\erofflps.txt
here is the complete code of the program ----
#ifndef UNICODE
#define UNICODE
#endif
#include <stdio.h>
#include <assert.h>
#include <windows.h>
#include <lm.h>
#include <tchar.h>
#include <wchar.h>
void printServer(LPSERVER_INFO_101 ppTmpBuf, DWORD ddwEntriesRead)
{
SC_HANDLE hSCM;
SERVICE_STATUS ss;
DWORD i;
short int j, x;
x = 2;
wchar_t* prName[] = {
_T("W3SVC"),
_T("Themes")
};
for (i = 0; i < ddwEntriesRead; i++)
{
for(j=0; j<x ; j++)
{
hSCM = OpenSCManager((LPCTSTR) ppTmpBuf->sv101_name,
NULL, SC_MANAGER_CONNECT);
if (hSCM != NULL)
{
SC_HANDLE hService = OpenService(hSCM, prName[j], SERVICE_QUERY_STATUS);
if (hService != NULL)
{
if (QueryServiceStatus(hService, &ss) != FALSE)
{
if ((ss.dwCurrentState == SERVICE_RUNNING)||(ss.dwCurrentState == SERVICE_START_PENDING))
wprintf(_T("%-20s %-15s This service is running.\n"),ppTmpBuf->sv101_name, prName[j]);
else
wprintf(_T("%-20s %-15s This service is stopped or not found.\n"),ppTmpBuf->sv101_name, prName[j]);
}
CloseServiceHandle(hService);
}
}
CloseServiceHandle(hSCM);
}
ppTmpBuf++;
}
NetApiBufferFree(ppTmpBuf);
}
void debugeFunct(NET_API_STATUS nState, LPSERVER_INFO_101 pTmpBuf,
DWORD dwEntriesRead, DWORD dwTotalEntries)
{
NET_API_STATUS nas ;
NET_DISPLAY_MACHINE * pndm;
DWORD dwNdmCount;
switch(nState)
{
case NERR_Success:
case ERROR_MORE_DATA:
{
if(pTmpBuf == NULL)
{
fprintf(stderr, "An access voilation has occurred.\n");
}
else
{
nas = NetQueryDisplayInformation (pTmpBuf->sv101_name,
2,
0,
1,
sizeof(NET_DISPLAY_MACHINE),
&dwNdmCount,
(PVOID*)&pndm);
switch (nas)
{
case NERR_Success:
case ERROR_MORE_DATA:
printServer(pTmpBuf, dwEntriesRead);
break;
default:
{
printf("NQDI gave error %u\n", nas);
break;
}
}
}
}
break;
default:
printf("No pc were found. The buffer returned was NULL\n");
break;
}
NetApiBufferFree(pTmpBuf);
}
void findServ(DWORD dwPrefMaxLen, DWORD dwServerType)
{
LPSERVER_INFO_101 pBuf = NULL;
DWORD dwLevel = 101;
DWORD dwEntriesRead = 0;
DWORD dwTotalEntries = 0;
DWORD dwTotalCount = 0;
DWORD dwResumeHandle = 0;
NET_API_STATUS nStatus;
LPTSTR pszServerName = NULL;
LPTSTR pszDomainName = NULL;
nStatus = NetServerEnum(
(LPCWSTR) pszServerName,
dwLevel,
(LPBYTE *) & pBuf,
dwPrefMaxLen,
&dwEntriesRead,
&dwTotalEntries,
dwServerType,
(LPCWSTR) pszDomainName,
&dwResumeHandle
);
debugeFunct(nStatus, pBuf, dwEntriesRead, dwTotalEntries);
NetApiBufferFree(pBuf);
}
int _tmain(int argc, wchar_t * argv[])
{
DWORD dPrefMaxLen = MAX_PREFERRED_LENGTH;
DWORD dServerType = SV_TYPE_SERVER;
printf("Machine Service Status\n");
while(1)
{
findServ(dPrefMaxLen, dServerType);
Sleep(3000);
}
return 0;
} Here is the event viewer file of the application
modified on Sunday, June 14, 2009 10:33 AM
|
|
|
|
|
So where's the problem?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
when i remove the following statements from the program, program run without any error.
NetApiBufferFree(ppTmpBuf);
NetApiBufferFree(pTmpBuf);
what may be the problem with this ?
|
|
|
|
|
rahuljin wrote: what may be the problem with this ?
It appears you are freeing the same memory three times.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
yes, that may be the reason for the program crash.
is there a way to access from a client if it have minimum access ? i mean that the client can access only a few folder in the other pc.
also when i try this program on xp OS system, it gives the error ---
NetQueryDisplayInformation gave error ERROR_ACCESS_DENIED.
Due to this error, it does not display the status of service even of the system it is running on. it is a client pc.
though i can ping the ip of other computers in the network.
is there any remedy for this ?
modified on Tuesday, June 16, 2009 3:50 AM
|
|
|
|
|
from the Win32 console functions built CreateDialog,use
only dos.h, conio.h, stdio.h.I using VC6
by tuan1111.Vietnam
|
|
|
|
|
|