|
I have Win32 console-based service app. I want to show its console for debugging purposes on the interactive user's desktop. How can I do this? I use AllocConsole to allocate a console in runtime.
Thanks,
Krishnan
|
|
|
|
|
Does the service output anything?
Kuphryn
|
|
|
|
|
How about to use TRACE and view it in DebugView or your IDE debug pane?
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
How to remove old VSS bind from project ?
When old project loads, i says that provider is not correct,
but disconnect and unbind in Visual studio,
not helps.
How to remove that old bind ?
And how to reconnect to new VSS ?
Thanks.
|
|
|
|
|
Would deleting vssver.scc and other source safe generated files help?
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Dear Friends
How can we embed a ON_BN_CLICKED function to Multithread?Please write to me and help me ASAP. Thanking you in advance.
Regards,
Bilar
|
|
|
|
|
Hi..this is just idea..
Track event ON_BN_CLICKED then call a treaded function that do all work in thread... otherwise I think it is difficult to get ON_BN_CL... in Thread..
this time I just have this Idea..I'll let u know if any other..Bye
---Sumit Kapoor--- sumit_kapoor1980@hotmail.com
|
|
|
|
|
Dear Sumit,
Thanks for the information but please let me know whether it will work in case of User-Interface Thread.
Thanks in advance........
Billar
|
|
|
|
|
HI Dear...
I'm also in doubt that whether thread work on User Interface or not..that's why I suggest u way that do not use that way...
I means.. let it do work as user interface do.. just call thread..when any event happen..
only I can help u...
OK! Good Bye..
---Sumit Kapoor--- sumit_kapoor1980@hotmail.com
|
|
|
|
|
The thread must own the button in order to get the results you are after. Since the button is most likely owned by the primary thread, interacting with it in another (secondary) thread is asking for trouble.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
The interface thread must receive the message. Then pass it along to your other threads using semaphores/conditions/queues, or whatever you use for intrathread communications.
--
Booohoo!
|
|
|
|
|
Hi
Well i am drawing on my clientDc and then i am writing to MemDC.
This MemDc i am using for saving clientDc content to Image file.
<br />
<br />
Class MyView<br />
{<br />
CDC MemDC;<br />
CBitmap m_MyBitmap;<br />
};<br />
<br />
Class MyView:rawDiag()<br />
{<br />
CClientDC dc(this);<br />
<br />
---------------<br />
Drawing code goes here. With default mapping mode <br />
---------------<br />
<br />
<br />
m_MyBmp.DeleteObject ();<br />
MemDC.CreateCompatibleDC (&ClientDC);<br />
m_MyBmp.CreateCompatibleBitmap (&ClientDC, 860, 1100);<br />
CBitmap *OldBitmap = MemDC.SelectObject (&m_MyBmp);<br />
MemDC.PatBlt (0,0,860,1100,WHITENESS);<br />
<br />
if(MemDC.StretchBlt(50, 0, 860, 1100, &ClientDC, 0, 0, 860,<br />
1100, SRCCOPY) == FALSE)<br />
AfxMessageBox("Failed to draw WFR diagram"); <br />
<br />
MemDC.SelectObject (OldBitmap);<br />
ClientDC.SetMapMode(MM_LOENGLISH);<br />
}<br />
<br />
Function for saving dc to Bitmap file. This code i got from codeproject post<br />
<br />
Class MyView::SaveDCtoBMP()<br />
{<br />
CString Filename;<br />
CFileDialog dlgFile (false,"*.*",NULL, OFN_HIDEREADONLY,"BMP Files: (*.bmp)|*.bmp||");<br />
dlgFile.m_ofn.lpstrTitle = "Save As Image File";<br />
<br />
int ret = dlgFile.DoModal(); <br />
if(IDOK == ret)<br />
{<br />
Filename = dlgFile.GetFileName (); <br />
CClientDC clientDC(::AfxGetMainWnd());<br />
clientDC.SetMapMode (MM_LOENGLISH);<br />
<br />
CBitmap TmpBitmap;<br />
TmpBitmap.CreateCompatibleBitmap(&clientDC, 860, 1100);<br />
CDC& ncDC = const_cast<CDC&>(MemDC);<br />
ncDC.SelectObject(TmpBitmap);<br />
ncDC.SetMapMode (MM_LOENGLISH);<br />
<br />
CDIBSectionLite dib;<br />
HBITMAP hnd = (HBITMAP)m_WfrBmp.GetSafeHandle (); <br />
dib.SetBitmap (hnd);<br />
dib.Save(Filename); <br />
ncDC.SelectObject(m_WfrBmp); <br />
TmpBitmap.DeleteObject ();<br />
}<br />
}<br />
<br />
I get following image as bitmap file.
I want only the clientdc content but it seems that it provides screen capture
How to attach image file alongwith post?
Leave your mark wherever you go
|
|
|
|
|
Is there any solution for this problem?
why i am getting complete mainframe window while i am using teh clientDC
I had even tried with ClientDc clientDC(this) still then.?
Leave your mark wherever you go
|
|
|
|
|
How about to use GetDCEx where you can be more specific in getting your DC.
And by the way, why is it that your bitmap size is hard-coded (below)?
Why not to use CWnd::GetClientRect(...) instead to get the size?
CBitmap TmpBitmap;
TmpBitmap.CreateCompatibleBitmap(&clientDC, 860, 1100);
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Waht are you trying to do.. Are u calling the save bitmap. actually it seems to get the main window and draws the client area.. Tell me ur requirement.
Han
|
|
|
|
|
Please follow the following link for better idea
http://www.codeguru.com/forum/showthread.php?s=d09323bd39f2dd0a942e34fe1155af42&threadid=296795
My main aim is to draw the content to view such that when user wants he can save the same to image file. Thats it?
What i tried that i drawn completely into the ClientDc and at the end (see first post) i am making the memory device context and then storing teh content to the image file.
Well but it seems that MemDC is taking the complete Mainwindow instead of the required clientdc.
Help me in this regard
Thanks in advance
sandeep
Leave your mark wherever you go
|
|
|
|
|
Hi i am trying to use ole Ipicture interface to load pictures of different formats but the OleloadPicturePath method fails.
What i am doing is given below.
any help would be appreciated and a lot of thanks in advance.
void * CMap::OpenGraphics(char * name)
{
IPicture *Ipic = NULL;
SIZE metric,pixel;
const int H_METRIC_PER_INCH = 2540;
HDC hdcScreen =GetDC(NULL);
HRESULT hr;
int SxpixPerInc = GetDeviceCaps(hdcScreen,LOGPIXELSX);
int SypixPerInc = GetDeviceCaps(hdcScreen,LOGPIXELSX);
unsigned short OlePathName[512];
ReleaseDC(NULL,hdcScreen);
mbstowcs(OlePathName,name,23);
char s[10];
MessageBox(NULL,itoa(int(OlePathName),s,10),"OLE",MB_OK);
hr = OleLoadPicturePath(OlePathName,NULL,0,0,IID_IPicture,(void **)(Ipic));
if(hr)
{
MessageBox(NULL,"ERROR WHILE LOADING PIC PATH","",MB_OK);
return 0;
}
if(Ipic)
{
Ipic->get_Height(&metric.cy);
Ipic->get_Width(&metric.cx);
pixel.cx = (SxpixPerInc*metric.cx + H_METRIC_PER_INCH/2)/H_METRIC_PER_INCH;
pixel.cy = (SypixPerInc*metric.cy + H_METRIC_PER_INCH/2)/H_METRIC_PER_INCH;
ImageInfo.Ipic = Ipic;
ImageInfo.pixel = pixel;
ImageInfo.metric=metric;
ImageInfo.path = name;
return Ipic;
}
return 0;
}
|
|
|
|
|
Hi there,
You are missing an & in front of Ipic.
hr = OleLoadPicturePath(OlePathName,NULL,0,0,IID_IPicture,(void **)(<big>&</big>Ipic));
Fabian
|
|
|
|
|
Hello everyone.
I want to attach a dialog to display as a view. How to do it?
Please help me.
Thank you.
-Freehawk
|
|
|
|
|
do you mean of FormView
Leave your mark wherever you go
|
|
|
|
|
Just use CFormView class.
|
|
|
|
|
Dear Friends,
Suppose i got an ActiveX control (or any COM dll). I am distributing it will by application. Now the problem is that anyone can utilize that dll or OCX. I want to prevent others to use my OCX and dlls. How can i ensure the security of my COM controls so that no one else can use it.
Imtiaz
|
|
|
|
|
HI One Idea is...
Create Time:
in OCX or DLL define a variable with some value let XXXX
& check at load time. if false then exit.
On Use time:
at contructor or on_load set that value as XXXX(as u set that in coding u know that..) & then start application....
OK! Bye
---Sumit Kapoor--- sumit_kapoor1980@hotmail.com
|
|
|
|
|
MapViewOfFile() if giving me an address that is out of process address range. Trying to use it gives me an access violation as expected. All parameters passed in to MapViewOfFile seems to be fine. Anyone has faced the same problem before ?
Thanks
|
|
|
|
|
(From MSDN)
Reading from or writing to a file view can cause an exception. For example, accessing a mapped file that resides on a remote server can generate an exception if the connection to the server is lost. Exceptions can also occur because of a full disk, because the file is shared and a different process has locked a byte range, or because of an underlying device failure or memory allocation failure. To guard against exceptions due to input and output (I/O) errors, all attempts to access memory mapped files should be wrapped in structured exception handlers.
Sonork 100.41263:Anthony_Yio
|
|
|
|