|
We are using Visual Studio .Net and dump a lot of debug info of our application to a console. Normally this is not a problem, however sometimes the console hangs and I cannot set the focus to the debugger anymore. And if I start the task manager, the whole system seems to hang.
We do use multiple thread to log information to the console, so I created the threads with _beginthreadex instead of CreateThread, but that does not seem to make any difference. Any one got a clue why this might be happening?
|
|
|
|
|
Maybe you need to make calls to printf thread safe, by using a CRITICAL_SECTION object....
void theadsafe_printf(char *lpzText) {
EnterCriticalSection(&cs);
printf("%s",lpzText);
LeaveCriticalSection(&cs);
}
Use InitilizeCriticalSection() to create the cs object.
and DeleteCriticalSection() when finished at the end of your app.
|
|
|
|
|
can anyone plz tell me how to convert an ascii to string and ascii to char using vc++
|
|
|
|
|
What you mean by "ascii"?? Do mean ascii value as an integer or ascii value as a string, i.e. Do you want to convert something like "979899" into "abc"?? Please clarify
ARSALAN MALIK
|
|
|
|
|
Hello to everyody,
I want to draw a line thta connect two points...
I have to paint the line of one color...until here it's ok
But the problem is that I have to paint a piece of it of another color from one point to a distance done.
How can i do it? Because maybe i will need a line equation?
Thanks
|
|
|
|
|
You will definitly need line equation. If you require only two colors (not graduated), i suggest you to draw two lines instead of one using different color. You need to find the coordinate of dividing point using line equation etc.
ARSALAN MALIK
|
|
|
|
|
Hi,
I change the font of the Window...and when i do DrawText it doen't work...with TextOut YES but with DrawText NOT...why? How can i do it with DrawText?
This is the code i use to set the font
CFont font;
LOGFONT lf;
memset(&lf, 0, sizeof(LOGFONT)); // zero out structure
lf.lfHeight = 12; // request a 12-pixel-height font
strcpy(lf.lfFaceName, "Arial"); // request a face name "Arial"
VERIFY(font.CreateFontIndirect(&lf)); // create the font
// Do something with the font just created...
CClientDC dc(this);
CFont* def_font = dc.SelectObject(&font);
dc.TextOut(5, 5, "Hello", 5);
dc.SelectObject(def_font);
// Done with the font. Delete the font object.
font.DeleteObject();
Thanks
|
|
|
|
|
Hi,
I want to create a DLL which puts and icon in the taskbar on click of tht icon an exe is run.
I wrote the following code.
The Compiler is not recognising the VERIFY Macro and AfxGetInstanceHandle method.
This code might be wrong becoz i ma jus trying .
Could someone help me out with this.
<br />
#include <windows.h><br />
#include <shellapi.h><br />
#include "example.h"<br />
#define MYWM_NOTIFYICON (WM_USER+2)<br />
<br />
BOOL WINAPI DllMain (HINSTANCE hinstDLL,
DWORD fdwReason,
LPVOID lpvReserved)
{<br />
return TRUE;<br />
}<br />
<br />
EXPORT void WINAPI Systray ()<br />
{<br />
DWORD dwMessage=NIM_ADD;<br />
NOTIFYICONDATA tnd;<br />
HWND m_hWnd;<br />
tnd.cbSize = sizeof(NOTIFYICONDATA);<br />
tnd.hWnd = m_hWnd;<br />
tnd.uID = IDR_TRAYICON;<br />
<br />
tnd.uFlags = NIF_MESSAGE|NIF_ICON;<br />
<br />
tnd.uCallbackMessage = MYWM_NOTIFYICON;<br />
<br />
<br />
VERIFY( tnd.hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE (IDR_TRAYICON)) );<br />
<br />
tnd.uFlags = NIF_MESSAGE|NIF_ICON|NIF_TIP;<br />
<br />
<br />
Shell_NotifyIcon(dwMessage, &tnd);<br />
<br />
if(dwMessage == MYWM_NOTIFYICON)<br />
{<br />
if((LPARAM)tnd.uCallbackMessage==WM_LBUTTONDBLCLK)<br />
{<br />
if((WPARAM)tnd.uCallbackMessage==IDR_TRAYICON)<br />
{<br />
ShellExecute(NULL, "open", "http://www.brigsoft.com/", NULL, "", SW_SHOW);<br />
}<br />
<br />
}<br />
}<br />
}<br />
Thanks
U get wht u Give
|
|
|
|
|
Hello,
i need to load (from a file, or from a resource) a jpg to set dialog background.
Anybody can help me, please?
I only found solutions for bitmpap files
Lewix
|
|
|
|
|
|
how to convert a string to char so that i can get the ASCII value in vc++?
|
|
|
|
|
if you want to convert a CString, I used the following once in a similar situation.
define the next:
#if defined (_UNICODE) || defined (UNICODE)
#define _tcstombs wcstombs
#else
#define _tcstombs strncpy
#endif
//in your code you can then convert CStrings to ascii strings--
CString sOriginalStr;
.... //somewhere here sOriginalStr gets a value
char* ascStr = new char[sOriginalStr.GetLength()+1];
_tcstombs(ascStr, sOriginalStr, sOriginalStr.GetLength()+1);
.. //do your thing with the ascistring
delete[] ascStr;
Hope this gets you along...
Greetz,
Davy
|
|
|
|
|
//Let string be
char string[]="acsd";
for(int i=0;i
|
|
|
|
|
plz tell me how to convert a char to ascii using vc++?
|
|
|
|
|
you can easily assign the ascii value to an integer variable....
int i;
char c='A';
i=c; // i is now 65.
|
|
|
|
|
Hi,
I would like to create an ActiveX and I would like to resize the window to an specific size when the user tries to resize it. Someone has told me I have to use WM_SIZE adding all the code required inside it.
Which is this code? I have to use GetWindow?
Help please
Thanks a lot
|
|
|
|
|
javi_jmc wrote:
Someone has told me I have to use WM_SIZE adding all the code required inside it.
this can't be TRUE as MSDN state that the application must not send WM_SIZE message to it's WINDOW
javi_jmc wrote:
to resize the window to an specific size
better use api's like [MoveWindow] and [SetWindowPos]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Thanks
But how can i do it? because i want to fix the initial window size of the ActiveX before adding it to the application
|
|
|
|
|
Hi All,
I want to write software modems(VC++/MFC/SDK).
Please let me know if any algorithm or links are available with you.
Thanks
|
|
|
|
|
I have a situation similar to following:
int b;<br />
<br />
int afunction() {<br />
int b = 0;<br />
...<br />
}<br />
I need to access global b in afunction?? C does not have :: operator. I cannot change the identifier of both local and global variable b. Is there a way around??
ARSALAN MALIK
|
|
|
|
|
Arsalan Malik wrote:
I need to access global b in afunction??
No, there is no such operator in C language.
Arsalan Malik wrote:
Is there a way around??
May be you can write a getter function for the global b.
suhredayan There is no spoon.
|
|
|
|
|
Arsalan Malik wrote:
Is there a way around??
Yes, don't use b in both spots.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Try this:-
int b;
int afunction() {
extern int b = 0;
...
}
|
|
|
|
|
Try this
int b;
int afunction()
{
int *ptr= &b;
int b = 0;
.....
}
|
|
|
|
|
could anyone plz tell me as soon as possible how to convert an unsigned char to const char using vc++ code?
|
|
|
|