|
Create a hidden window in the service and in then message proc you can then listen to the messages.
Interviewer (me) : "Did you install Linux all my yourself?"
Candidate : "Yes i installed Linux all my yourself."
|
|
|
|
|
Currently, I have this code in my on paint event in a view.
<br />
CPaintDC dc(this);<br />
<br />
CPoint originalSize = matrix.GetSize();<br />
int y, x;<br />
<br />
for (y = 0; y < size.y; y++)<br />
{<br />
for (x = 0; x < size.x; x++)<br />
{<br />
dc.SetPixelV(CPoint(x,y), obj.GetColorRef(CPoint(x, y)));<br />
}<br />
}<br />
<br />
As you can understand, this is pretty slow with soewhat bigger pictures where for example, tje size is over 1000 x 1000 pixels. A solution, as far as I know, is to use a memory DC. However, I am doing something wrong.
I want to create the memory DC with the following
<br />
CPaintDC dc(this);<br />
CDC pdc;<br />
dc.CreateCompatibleDC(&pdc);<br />
<br />
CPoint originalSize = matrix.GetSize();<br />
int y, x;<br />
<br />
for (y = 0; y < size.y; y++)<br />
{<br />
for (x = 0; x < size.x; x++)<br />
{<br />
pdc.SetPixelV(CPoint(x,y), obj.GetColorRef(CPoint(x, y)));<br />
}<br />
}<br />
<br />
dc.BitBlt(0, 0, size.x, size.y, ...) <br />
<br />
However, the first time only a black block was drawn then, when resizing things go wrong (the app crashes), where a colored block should be drawn. What am I doing wrong, and if I am doing it wrong, how should I do it?
LPCTSTR Dutch = TEXT("Double Dutch ");
|
|
|
|
|
You need to allocate a bitmap (ideally a DIBSection) of the appropriate size and select it into the device context. The default bitmap in a freshly created DC is 1x1. If you use a DIBSection, you can get direct access to the bitmap's pixel data. This can dramatically speed up pixel manipulation.
|
|
|
|
|
The effective way of createing a memory dc.
HDC memDC = CreateCompatibleDC ( hDC );
HBITMAP memBM = CreateCompatibleBitmap ( hDC );
SelectObject ( memDC, memBM );
Interviewer (me) : "Did you install Linux all my yourself?"
Candidate : "Yes i installed Linux all my yourself."
|
|
|
|
|
Go look in the "Bitmaps & Pallettes" section of codeproject; both CDibSectionLite and CDibData provide ways of accessing pixels directly without having to select them into a DC first.
Note: Accessing pixel data through any DC is very slow.
INTP
|
|
|
|
|
As was suggested before you need to create a compatible bitmap. You also need to pass the dc from the paint DC to the CreateCompatibleDC function, not the other way around.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
hi, i made a program in MFC C++ 6 and want to put music in the background. is there an easy way to do this?
thanks,
til
|
|
|
|
|
|
hi all,
iv been programming in MFC (visual c++ 6) for a few months and i am confused at the difference between public, and protected code. Whats the point of putting public at the top of a section, or private. Please help
many thanks
til
|
|
|
|
|
Protected indictates that only member functions, friends, and derived classes can access the members of that class. Public indicates that the members of that class are accessible by all. Private indicates that only member functions and friends can access the members of that class.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
private keeps things from being utilized by other classes on accident, or maybe even another user if you plan to let someone else use your classes down the line.
Protected only allows access by derived classes, so it's private to itself and any of its children that are derived from it.
public is letting everyone have access, so that if you have a CEdit control object declared as public, another dialog or screen can access it.
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Cheers guys, i appreciate it alot
til
|
|
|
|
|
I am using MFC, how would I go about finding and displaying all of the CD/DVD drives of the users computer? I have been looking around for articles, and have not found anything yet. Any help is appreciated.
-Dev578
|
|
|
|
|
Take a look at _getdrives() and GetDriveType() in MSDN.
There is also an example.
|
|
|
|
|
mmica wrote:
Take a look at _getdrives()...
This does not sound like a valid function. Are you sure it exists?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Yeah it does, many microsoft C api/functions starts with _ for some compatiblity issue.
Interviewer (me) : "Did you install Linux all my yourself?"
Candidate : "Yes i installed Linux all my yourself."
|
|
|
|
|
Have you seen the Enumdisk1 sample (article Q264203) on MSDN? It uses the Setup class GUID_DEVCLASS_DISKDRIVE GUID (4D36E967-E325-11CE-BFC1-08002BE10318 I think) to enumerate all the disk devices that are installed in the system.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
|
I have an application that currethly supports a socket connection but I want to add a Dialog to support setting up a Dial Up connection. What APIs can I use to do that ?
Thanks
|
|
|
|
|
Check out RasCreatePhonebookEntry() and the other RAS functions.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
You could use the WinInet API by importing them into your project [DllImport("wininet.dll")]. Interfaces like InternetGetConnectedState and InternetAutodial would probably be helpful - check the WinInet docs for details.
Cheers,
Lee.
Lee H Fuller
lee@fullerdata.com
|
|
|
|
|
Dundas Software has a free dialup MFC class which can be downloaded from here.
Ivor S. Sargoytchev
Dundas Software
|
|
|
|
|
Hi,
I have a weird problem in DCOM. Everything works fine until the network goes down. If after a short period of network failure, when the network connection is restored, and I do CoCreateInstanceEx again, that works ok too, however, now I can't get a QueryInterface to succeed to get an interface pointer. It fails with some RPC error in the HRESULT. This behavior is intermittant.
Pl. help.
Thanks,
nct_11
|
|
|
|
|
Is it possible/easy to convert MFC Doc / View App to a COM / DCOM server? What I want to do is to have an external application query my running MFC application for the status of several internal operations using COM.
John
|
|
|
|
|
Not easy thing to do, plus the mfc application may not be employing the best techniques for COM/DCOM application to work efficiently
Interviewer (me) : "Did you install Linux all my yourself?"
Candidate : "Yes i installed Linux all my yourself."
|
|
|
|