|
hi,
I am using,winsnmputils.exe for get and getnext, now i want to set snmp can u plz help me how to write the code for set.
narasimha varma p
|
|
|
|
|
how to do socket pgming using multi threading???
|
|
|
|
|
Search cp, there are lots of articles.
Don't try it, just do it!
|
|
|
|
|
I have a project on code project just to help you.
- Network Administrator by euacela
i use mutithreading to do it and winsock ofcourse
gabby
|
|
|
|
|
Hello Every Body,
I am facing problem to allocate the global memory to string, which i am going to use with WM_GETTEXT msg during interprocess communication to get text from edit box of another application.
Thanks very much.
[Vote One Here, Complete my Survey....]
Alok Gupta visit me at http://www.thisisalok.tk
"I Think Believe this Will Help"
|
|
|
|
|
Hi,
what do u mean exactly?
SkyWalker
|
|
|
|
|
Hello Sir,
actually i amn't able to use GlobalAlloc and other heap related function, I requires a good reference for that, MSDN is no help till now.
Sir,if you know any link related to memory managment,etc please refer it to me......
I am very much Thankful to u for your reply!!!
[Vote One Here, Complete my Survey....]
Alok Gupta visit me at http://www.thisisalok.tk
"I Think Believe this Will Help"
|
|
|
|
|
|
|
|
|
I am developing a computer monitoring application (client /server), in which the client will send the information about its current devices to server by using an api ( or the server will try to know the devices of client by envoking an api)
Do you know of any api , which lists the devices on a computer? I tried GetCurrentHwProfile ( ) , it fetches the "profile file" which contains the information about the devices configuration.
While seraching MSDN i came across WMI SDK (but it uses VBScript) ? will it be good .Considering the half the program will be using C (GetUserName() api) and half of the program will be using VBScript.
Please help me out!!
Thanks
|
|
|
|
|
You can find this information in the Setup API[^] functions. Be aware that these are not available in Windows 9x/ME.
Software Zen: delete this;
|
|
|
|
|
Here is my worker thread that I create ever 100ms in the OnTimer() function, it works but uses 97% of the cpu. Any help would be appreciated.
POINT pt; // Global for GetMouseProc & OnTimer.
UINT GetMouseProc(LPVOID pParam)
{
HWND hwnd = ::GetDesktopWindow();
::SetCapture(hwnd);
::GetCursorPos(&pt);
::ReleaseCapture();
::ExitThread(0);
return 0;
}
void CColorTakeDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
HWND m_hwnd = ::GetDesktopWindow();
CString str;
// =======================================================================
// Get the mouse pointer position and display it
// =======================================================================
DWORD ExitCode = STILL_ACTIVE;
HANDLE m_hThread;
if(pThread == NULL)
{
pThread = AfxBeginThread(GetMouseProc, this, THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED, NULL);
pThread->m_bAutoDelete = FALSE;
m_hThread = pThread->m_hThread;
}
pThread->ResumeThread();
while(ExitCode == STILL_ACTIVE)
{
::GetExitCodeThread(m_hThread, &ExitCode);
}
delete(pThread);
pThread = NULL;
str.Format("X: %d, Y: %d", pt.x, pt.y);
m_mouse.SetWindowText((LPCTSTR)str);
Old dog learning new tricks!
|
|
|
|
|
Roger65 wrote:
while(ExitCode == STILL_ACTIVE)
{
::GetExitCodeThread(m_hThread, &ExitCode);
}
This is what is taking up the CPU time. If you really need a seperate thread here (doubt it) then you are better off using events and calling WaitForSingleObject() on that event. Even better would be to set the threads m_bAutoDelete member to TRUE and wait on the thread handle.
Check out http://www.codeproject.com/threads/usingworkerthreads.asp[^], especially the section entitled "Thread Shutdown Without Polling".
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
The reason for the seperate thread is if the SetCapture is in the same thread as the controls window they don't get mouse messages. You say wait for the thread handle, what is it destrored?
Old dog learning new tricks!
|
|
|
|
|
For what you are trying to do in the example given I think you are over-thinking your problem. Why even call SetCapture to begin with? Why even have a worker thread? All you seem to want is to get the cursor coordinates every timer tick and display them on your m_mouse window. GetCursorPos does not care about which window has the capture, it justr returns the position of the cursor in screen coordinates. Why won't something like this work?
void CColorTakeDlg::OnTimer(UINT nIDEvent)
{
POINT pt;
GetCursorPos(&pt);
CString str;
str.Format("X: %d, Y: %d", pt.x, pt.y);
m_mouse.SetWindowText(str);
} No worker threads, no global variables, and definitely cleaner than what you have.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
That was version 1.0 it didn't get the cursor from the desktop, just the dialog box. You did however give me a clue, I put a Sleep(1) inside the while(exitcode == STILL_ALIVE), cpu usage dropped to 0.
Old dog learning new tricks!
|
|
|
|
|
I'm currently trying to convert my MFC program to display UNICODE characters. I've made all of the changes to compile and run as Unicode. To try to display the characters in japanese, I do the following:
f.SetFaceName(_T("Lucida Sans Unicode") );
f.SetCharSet( SHIFTJIS_CHARSET );
CUIFont *testFont = new CUIFont( GetSourceView(), "test source font", f.GetLOGFONT() );
oldfont = pDC->SelectObject( testFont );
pDC->ExtTextOut(x, y, ETO_CLIPPED, NULL, sNormal_First, NULL);
After changing the font and character set, the characters change, but seem to be a CJK representation of the characters. I looked at the hex value 0x82A0 which is one of the characters. In the Unicode code table of 932 (Japanese Shift-JIS), I see the character I think should be displayed with this value. After searching other Unicode code tables, I find that the character actually being displayed is from the Unicode code table 1200 (Unicode) which shows CJK Unified Ideographs. I've searched to see how to modify the code page and have had no luck. I think I need to set it to 932 instead of 1200. Anybody have any suggestions? It would be nice to write some code that does the setting dynamically so that it will work with other languages. I notice that using GetACP returns the system code page, but when it is 932 my program still displays the wrong character. Help!!
Jim Herren
Visual Inspect Debugging
Hewlett Packard
|
|
|
|
|
If you're compiling with the UNICODE flag set, you'll be getting the Unicode versions of the APIs - e.g. ExtTextOutW rather than ExtTextOutA . The W versions do not convert the buffer passed to them, they treat it as UTF-16. By contrast the A versions convert their arguments then call the corresponding W version (in the main).
You should convert your strings to UTF-16. If they're dynamic strings use MultiByteToWideChar with an appropriate codepage parameter. If they're literal strings, use the L prefix on the declaration. Be aware that the compiler uses the current code page in effect at compile time to translate the source literal to UTF-16 in the compiled code.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hi Mike,
I appreciate the response. Your suggestion to use MultiByteToWideChar worked perfectly. My problem was that I was trying to format the string with my Server instead of using the function you recommended. After we did this, we were seeing the correct Japanese characters.
Thanks again,
Jim Herren
|
|
|
|
|
Hello
i wan't to create an application that react for example at a string input in word.
i get every key over a SetWindowsHookEx(WH_KEYBOARD_LL....
Now i have a problem with the KBDLLHOOKSTRUCT.
i can't analyse is the text "hello", or "HELLO" --> Sorry, for my bad english, i hope - you know what i mean.
okay, i can interpret the flag, scantime, etc. but its to hard for a beginner.
has anybody a idea, wherefrom i get a algorithm to interpret the KBDLLHOOKSTRUCT?
thanks
|
|
|
|
|
KBDLLHOOKSTRUCT.vkCode is the key that was pressed. It is a number between 0 and 254 (ASCII).
Create an array with n items (n is the length of the string you are searching for) and a counter, which represents the current index of the array.
This example is for the word "hello":
char szArray[5];
int iIndex = 0;
void func(KBDLLHOOKSTRUCT kbs)
{
int i, iCurrentIndex;
char szLocalArray[6];
szArray[iIndex++] = (char)kbs.vkCode;
if( iIndex == 5 )
iIndex = 0;
for( i = 0, iCurrentIndex = iIndex, szLocalArray[5] = '\0'; i < 5; i++ )
{
szLocalArray[i] = szArray[iCurrentIndex++];
if( iCurrentIndex == 5 )
iCurrentIndex = 0;
}
if( stricmp( szLocalArray, "hello" ) == 0 )
}
I hope that helps (maybe there an error in the code, didn't have to time to test it *hehe*).
Don't try it, just do it!
|
|
|
|
|
Hi
Thank you - but it is not so easy.
If i press a key, i get two messages with different timestamps and different flag-state.
Also, i dont use the "Shift", or "CTRL" Key's.
regards
|
|
|
|
|
I created a toolbar with the style TBSTYLE_FLAT in order to get hot tracking so that the buttons would get highlighted when the cursor moved over them. But now the toolbar is transparent and the part of the desktop under the window shows through. I tried redrawing the toolbar background by handling WM_ERASEBKGND but I end up drawing over the buttons and erasing them, so the only way to see them is by moving the mouse over them. Is there any way that I can paint the background of the toolbar without drawing over the toolbar buttons or a way to tell the toolbar buttons to redraw themselves?
|
|
|
|