|
1. A rather polemic question, isn't it?
2. Of course "correct color" is something more than one bit per pixel (i.e. not what I received in CreateCompatibleBitmap).
3. Yes, that's what my comparisons resulted.
Thanks
|
|
|
|
|
Vancouver wrote: 1. A rather polemic question, isn't it?
Wasn't meant to be. Using GetDeviceCaps(NUMCOLORS) is useful for getting a color table size and
that's about it. The BITSPIXEL and PLANES items are the most useful for creating a DDB/DIB with
a format which matches a device. The NUMCOLORS item is helpful when you need to create a palette
and/or a color table.
Vancouver wrote: 2. Of course "correct color" is something more than one bit per pixel (i.e. not what I received in CreateCompatibleBitmap).
"Of course" to you, but to us non-mind readers it's not so obvious. In my original response I
posted code that does NOT return a bitmap with a monochrome format (unless you have your video
set to a monochrome mode). You stated something doesn't match the documentation, yet I am unable
to find what you were referring to specifically. This stuff hasn't changed since the beginning
of Windows so the documentation is pretty mature, so, I respectfully disagree .
Vancouver wrote: 3. Yes, that's what my comparisons resulted.
Since my original response you have found a solution so I guess that makes the above points
irrelevant anyway. I just won't be able to sleep at night if you go on thinking that you can't
create a DDB the same format as the screen...after all, you may need to do that someday - for
double buffering and the like.
Cheers!
Mark
Great job, team. Head back to base for debriefing and cocktails.
|
|
|
|
|
I found following, which might be useful for others, who don't have experience with GDI yet (like myself):
1. SetPixel works directly on the DDB, as well as on a memory DC (the latter has to be copied by BitBlt over the DDB). The performance is the same both ways, but via the memory DC it is flicker-free. On the other hand, when building a large image, the smooth construction of the image too can be an advantage.
However, SetPixel is terribly slow, it is suitable only for a small segment.
2. SetBitmapBits allows for working "quasy" on the buffer, i.e. working on an own device dependent buffer and copying it over the device context's buffer. This is very fast.
Interesting is, that it does work directly with the DDB; not only, that it does not report any error, but one can retrieve the same values with a subsequent GetBitmapBits.
HOWEVER, the content will not be displayed.
Doing the same on the memory context and copying that over the DDB works fine.
Unfortunately, this way three buffers are involved. This is not a small issue: each of them can be many megabytes large, and for the complete construction of the image, all three have to be processed in terms of reading and writing. It is not an ideal solution.
3. I got the very best (i.e. fastest) result by using a DDB without connected bitmap, and a DIB section, working directly on the bit map and BitBlt-ing it over the DDB.
|
|
|
|
|
I have to send a file over SFTP. Besides those SFTP third party solutions that are available, like WS_FTP etc.. Does MFC have some way of coding for SFTP. I can do regular FTP through MFC.
|
|
|
|
|
http://msdn.microsoft.com/downloads/sdks/platform/tpipv6/readme.asp[^]
Applications
The IPv6 Technology Preview for Windows 2000 contains a set of sample applications that you can use to experiment with IPv6-based traffic beyond the use of standard connection diagnostic tools such as ping6 and tracert6. The following applications are provided:
* HTTP client: The new Internet extensions dynamic link library (DLL), Wininet.dll, provides IPv6 capability so that Windows-based Internet browsers, such as Microsoft Internet Explorer, can make connections to both IPv4 and IPv6 Web servers.
* FTP client: The new File Transfer Protocol (FTP) client, Ftp.exe is capable of establishing FTP sessions with IPv4 and IPv6 FTP servers.
* Telnet client: The new Telnet client, Telnet.exe, is capable of establishing Telnet sessions with IPv4 and IPv6 Telnet servers.
* Telnet server: The new Telnet server, Tlntsvr.exe, is capable of establishing Telnet sessions with IPv4 and IPv6 Telnet clients.
========================================
http://msdn.microsoft.com/downloads/sdks/platform/tpipv6/faq.asp[^]
What tools are required for IPv6 application development?
For Winsock IPv6 application development, you will need the following:
* January 2000 Platform SDK * Visual C++ 6.0 or later * Microsoft IPv6 Technology Preview
led mike
|
|
|
|
|
Hi
I have a picture box in my dialog, but I need to write something on top of it.
The problem is that the onPaint dialog method is getting called before the control repaints itself, so I can never see the text.
Someone knows what can I do to avoid this, and be able to write on top of the picture box?
Thanks in advance
|
|
|
|
|
Use picture box onPaint method instead of dialog onPaint method.
I think, it's called event, not method.
|
|
|
|
|
At the end of the dialog's OnPaint method post a custom message to the dialog. In that custom message handler paint your text.
void CMyDialog::OnPaint()
{
...
CDialog::OnPaint()
PostMessage(WM_APP + 1, 0, 0);
}
LRESULT CMyDialog::OnWmAppPlusOne(WPARAM, LPARAM)
{
ClientDC dc(this);
dc.TextOut(...);
}
Now all the usual painting is done first, then you custom message gets processed to draw the text on top of all the other controls.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Thanks for the quick reply people
|
|
|
|
|
Add the WS_CLIPCHILDREN style to the dialog, so the dialog's window proc won't paint over its child controls.
|
|
|
|
|
how to access drives(including cd-drive) along with icons and display them on dialog and how to enable/disable drives permanently based on selection?
|
|
|
|
|
Like this?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Exactly David, but how to get registered version?
The same way i m planning to do vc++?
Any guidence is appreciated.
|
|
|
|
|
Super Hornet wrote: ...how to get registered version?
Purchase it from here.
Super Hornet wrote: The same way i m planning to do vc++?
Check out the HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoDrives key. While this will indeed hide the designated drives, it does not restrict access to them. There is another registry key that you can use that will allow only administrators to use the (CD-ROM and floppy) drives.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
In a similar way as i described in reply to your question entitled:
"How to disable USB Port/Drive permanently?"
registry, registry once more registry ......
|
|
|
|
|
Hi,
I have a client/server application which I have implemented using CSockets using serialization (as per Microsoft help on CSockets). This works really well, but the customer is now asking to be able to access to the server application using his web browser rather than my custom built client and I havent a clue as to how easy/hard this is going to be.
Anyone have some suggestions of what I would need to do to create web pages that request info from my server, and what changes I would need to make to the server?
Thanks.
Tony
|
|
|
|
|
|
Can you rewrite your server application as an ISAPI Extension[^] and just use IIS?
|
|
|
|
|
we can put the application in startup but its not the preferable method, Is there any better way of running an application at windows startup?
Suggestions are appreciated.
|
|
|
|
|
You can edit Windows registry:
RootKey="HKEY_LOCAL_MACHINE"
OpenKey= "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"
or
OpenKey= "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce"
for running an application once at win startup
Add new REG_SZ value type, which data is the path for your application
I've tried it with Win 2000
|
|
|
|
|
Thank you newbie its quite useful.
|
|
|
|
|
You can also use the root HKEY_CURRENT_USER with the same keys if you want to limit the app to a specific user. Also avoids the security issues around apps not being able to write to HKEY_LOCAL_MACHINE.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
|
Super Hornet wrote: Is there any better way of running an application at windows startup?
Make it a Windows Service[^] There is a C++ Application Wizard that supplies a starter project for a Service.
led mike
|
|
|
|
|
Hi,
I'm using MFC extension dll.
I've 2 questions.
1. Why do i get exception while trying this:
char* s1 = "";
char* s2 = abc";
strcpy(s1,s2); //exception
But if i try this it works:
char s1[255];
char* s2 = abc";
strcpy(s1,s2);
Why is this so?
2. I've an exposed function BOOL _stdcall SetName(CString& name)
There is a function defined in another class but in same dll as below.
void CMyClass::Myfn(CString& str)
{
m_str = str;
}
where m_str is CString variable declared in header and initialized as
m_str = "" in CMyClass constructor.
I create an object of CMyClass and call Myfn() in SetName.
SetName is called from a vb.net application.
I get exception while assigning m_str = str in Myfn();
(This works fine if i'm calling the dll from an MFC application.)
I solved the problem by making the following changes.
m_str declaration as char m_str[255] and removed initialization from constructor.
Myfn() as
void CMyClass::Myfn(char* str)
{
strcpy(m_str,str)
}
But how did it work? Will it create problem in anyother scenario?
Thanks & Regards,
sanju
|
|
|
|