|
Dear KarstenK,
I tried calling OnBconnect() in OnInitialUpdate().....it worked....Thanks
|
|
|
|
|
According to MSDN, the first parameter to CDC::DrawDragRect() is lpRect and it "specifies the logical coordinates of a rectangle"
However, when I pass in a pointer to a rect in logical coordinates, (DC mapping mode not in MM_TEXT) it draws the rect as if it were treating the rect as if it were in device coordinates.
I can draw a "Rectangle()" with the same rect using the same DC and that rectangle comes out as anticipated.
Is there a misprint in the MSDN and should the rect for CDC::DrawDragRect() be in device coordinates?
|
|
|
|
|
CDC::DrawDragRect() uses PatBlt() to draw the drag rect. If you directly call PatBlt() on the DC
do you get the same result as CDC::DrawDragRect()?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Anything I draw explicitly in logical space is coming out fine on my viewport. The mapping mode results are good for general primitives and blitting operations.
It wasn't that I couldn't provide my own implementation for DrawDragRect(), it was just that I was entertaining the idea that I might be missing something obvious as I'd rather use functionality thats already provided so my peers don't crucify me for reinventing the wheel.
I wasn't sure if it was well known that MSDN incorrectly states the word "Logical" or if that in fact is what it's supposed to do and I had something goofy in my code causing me to chase my tail.
Anyway, I'll play with some patterns and see what I get.
Thanks.
|
|
|
|
|
You could step into the call and see what's different than when you draw
it yourself.
I didn't see anything in there that changes the mapping mode but I didn't
do a runtime test.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
Sorry, but I just began learning C++ (I have better experiences in Java, PHP). Can anyone tell me how I can add GDI+ functionallity to my existing VS2005 C++ based project?
I've already searched for hours and everbody is just telling how to use the Classes right away but is missing the first step... yeah I know, maybe it's to simple, that's way. But I don't know it yet. I tried with adding System.Drawing.dll somehow to the project, but it didn't work.
Thanks in advance
Shi
|
|
|
|
|
I'm not sure about VC++ 2005, but in VC++ 2003...
(NOTE: this assumes native code)
// In stdafx.h
#include <gdiplus.h>
using namespace Gdiplus;
#pragma comment(lib, "GdiPlus")
// Somewhere else in app. Timing is important
// (i.e. don't call too early)
// I usually call it in an MFC app in the
// CDocument constructor with a boolean in
// the app to prevent multiple initialization
// attempts.
// Member in CWinApp or somewhere if not MFC app
ULONG_PTR m_gdiplusToken;
GdiplusStartupInput gdiplusStartupInput; // local variable
if (GdiplusStartup(&m_gdiplusToken,&gdiplusStartupInput,NULL)==Ok) {
// Ready to go
}
|
|
|
|
|
thx, intelli sense seems to work now. I hope the stuff will compile fine also
How can it be that there is no good microsoft tutorial that explains step by step how to do this.. like adding the header files to the folders, the *.lib stuff etc.?
But thx! I'm a step further
|
|
|
|
|
i want to add a new item menu whenever user right click a image file saved on hard disk. The right click context menu of windows explorer bar for the file should show a new item with the name upload to 123greeting and also want an event handler for it.
Make sure it should be for windows explorer and not for internet explorer.
pls help me out
Thanks in advance.
Dhiraj
Dhiraj Kumar Saini
|
|
|
|
|
You have two options
1. to write a shell extension refer http://www.codeproject.com/shell/shellextguide1.asp[^]
2. You can manually add a menu for file type. Take explorer ->Tools menu->Folder options->File type-> select the file type you want, click advanced. add new menu "123greeting". select your application that you want to run when user clicks that menu. The Filename will be passed to that application via command line
|
|
|
|
|
I send a command to a machine once, to which it sends out continuos data output. So OnReceive() event gets triggered. Now my problem is i need to set a timeout duration for this continuous string i receive. For e.g: if i do not receive any string for 2 secs then I display a MessageBox()
How can i achieve this??
Found this example on msdn but how do i execute these lines continuously?
DWORD dwStart = GetTickCount();<br />
if( GetTickCount() - dwStart >= TIMELIMIT )<br />
Cancel();
|
|
|
|
|
try to use this
clock_t start,end;
start=clock();
end=clock();
while((start-end)/1000<2);//2 means 2 seconds
messagebox("time out");
//try this out i used it in most of my applications
|
|
|
|
|
Dear Chandu,
This wouldnt suit my application.
What i m trying to do is that if OnReceive() of Winsock doesnt get triggered every 2 secs then i display the message box.
What you are doing is, you are setting start and stop somewhere(maybe in some function)...so if this funtion never gets called then i cant detect a timeout...
i hope you got the problem
|
|
|
|
|
Why don't you instead start a timer with a timeout of 2 seconds ? Then, in your OnReceive function, you can kill it and restart a new one.
And in the OnTimer function, you display your message box (the OnTimer function will only get called when the timer fires).
|
|
|
|
|
Dear Cedric,
Thanks for your suggestion. I am new to using timers but i reckon that this is what i would need to solve my problem(since a 'time-out' will trigger an event and that's what i want). If wrong then please correct me. I havent yet tried using 'timer'(stuck up with something more critical) but i have to within the next 1 day.
Thanks...
|
|
|
|
|
As Cedric Moonen said, you can set a timer. For a socket there will be a window assiciated with it.That window is a member of the structure_AFX_SOCK_THREAD_STATE; you will be able to get a pointer of that structure using _AFX_SOCK_THREAD_STATE* pState = _afxSockThreadState;
|
|
|
|
|
Hi
I am learning com programming. I want to ask a question about output files in idl compilation.
When i compile this file. It only generates FileName_h.h and FileName_i.c files.
import "wtypes.idl";<br />
<br />
[<br />
uuid(6F818C55-E6AD-488b-9EB6-511C0CCC0612),<br />
version(1.0)<br />
]<br />
library LibCOMServer<br />
{<br />
importlib("stdole32.tlb");<br />
importlib("stdole.tlb"); <br />
<br />
[ uuid(7F24AABF-C822-4c18-9432-21433208F4DC), <br />
oleautomation <br />
]<br />
interface ICOMServer : IUnknown<br />
{<br />
HRESULT Name([out] BSTR* objectname);<br />
}<br />
<br />
<br />
[ uuid(6AE24C34-1466-482e-9407-90B98798A712),<br />
helpstring("COMServer object") <br />
]<br />
coclass CoCOMServer<br />
{<br />
[default] interface ICOMServer;<br />
}<br />
}
But when i compile this code. It generates FileName_h.h, FileName_i.c, DllData.c, FleName_p.c
import "oaidl.idl"; <br />
import "ocidl.idl"; <br />
<br />
[<br />
object, <br />
uuid(318B4AD0-06A7-11d3-9B58-0080C8E11F14), <br />
helpstring("IVideo Interface"), <br />
pointer_default(unique) <br />
] <br />
interface IVideo : IUnknown <br />
{<br />
[helpstring("Obtain the signal value")] <br />
HRESULT GetSignalValue([out, retval] long* val); <br />
}; <br />
<br />
[<br />
object, <br />
uuid(318B4AD1-06A7-11d3-9B58-0080C8E11F14), <br />
helpstring("ISVideo Interface"), <br />
pointer_default(unique) <br />
] <br />
interface ISVideo : IUnknown <br />
{<br />
[helpstring("Obtain the S-Video signal value")] <br />
HRESULT GetSVideoSignalValue([out, retval] long* val); <br />
}; <br />
[<br />
uuid(318B4AD2-06A7-11d3-9B58-0080C8E11F14), <br />
version(1.0), <br />
helpstring("VCR Type Library") <br />
] <br />
library VcrLib <br />
{<br />
importlib("stdole32.tlb"); <br />
importlib("stdole2.tlb"); <br />
<br />
[<br />
uuid(318B4AD3-06A7-11d3-9B58-0080C8E11F14), <br />
helpstring("VCR Class") <br />
] <br />
coclass VCR <br />
{<br />
interface IVideo; <br />
interface ISVideo; <br />
}; <br />
<br />
};
I don't understand what the reason for this. What is absence in first idl files so the other files can't generated.
Thanks
|
|
|
|
|
idl is a little tricky. I am not a specialist.
Arent in the first place:
import "wtypes.idl";
in the seconsd:
import "oaidl.idl";
import "ocidl.idl";
You must look in your files. Often is it a "dependency", so if another file is included, there are extra items activated.
It looks like the second case is a dll project.
Greetings from Germany
|
|
|
|
|
Thank you.
I created an empty dll project and i only added .idl file and debug it both of them.
I also replaces import files. But nothing changes. It seems, It is not about import part of the codes.
|
|
|
|
|
I remember befor 7 years I got worked with some idl, and my collegues said me "that makes all the compiler: DO NOT TOUCH".
Sorry I got no clue. I can only guess, that the project wizard does some work to enable *.idl processing.
Greetings from Germany
|
|
|
|
|
iam using static picture control on the dialog box. actually my bitmap has alpha and red background color. this bitmap attached to static picture control. then problem is in Windows XP supporting alpha channel but in Windows 2000 it showing
same back ground color .
what i want is how can i hide the background color of the static picture control?
one more thing i wrote like this
<br />
<br />
HBRUSH CFileSelectionDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)<br />
{<br />
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);<br />
<br />
if(pWnd->GetDlgCtrlID()==IDC_STATIC_IMG)<br />
pDC->SetBkMode(TRANSPARENT); <br />
<br />
return hbr;<br />
}<br />
<br />
here IDC_STATIC_IMG is a member variable of static picture control.
Regards,
Srinivas
|
|
|
|
|
Try returning the result of GetStockObject(NULL_BRUSH) instead of the brush that the CDialog::OnCtlColor returns
|
|
|
|
|
Hi,
I am trying to read mrt.log file programatically (vc++).
This file is generated after running mrt.exe (malicious software removal tool by microsoft - can be freely downloaded from msdn).
But I am not able to read this file. I am displaying the contents of a file line by line.
It is giving some garbage values.
If I change its extn to .txt, i still cant read it.
If I copy its contents in some other .txt file,then I am able to read it.
It is behaving in strange way.
Is there any restriction on reading this file or something?
Can someone please guide me for reading this file?
Thanks,
Manasi
|
|
|
|
|
Manasi D wrote: I am trying to read mrt.log file programatically (vc++).
I am not sure, but may be the file is not purley ASCII file. It may be UNICODE or UTF-8 encode. Open the file in a binary mode using msdev IDE, and check few bytes in the begining.
if the first two is FF, FE -> it will be UNICODE,
EF BB BF -> UTF-8 and so on. So first you need to identify the format in which the file is encode. You can convert texts in such formats to normal string using the WideCharToMultiByte() and MultiByteToWideChar() API's
|
|
|
|
|
Is there an api or method to convert a file path to the dos file path ( 8.3 ). I can't seem to find much on the topic.
|
|
|
|