|
I am new to this forum and am unsure how to go about this question. I use:
void CChildGraphFrame::OnPaint()
{
CPaintDC dc(this); // device context for painting
CDC* pDC = &dc;
Render(pDC); //paint structure
}
This procedure paints the image to the screen. What I don't understand is how to save this structure to a file. I also, don't understand if I have a DIB or DDB. If a resource (website, example, etc) can be given to me or atleast a good starting point.
Thank you for your time,
Jim D
|
|
|
|
|
If, after painting, you want the contents of the region that was painted, you could call CDC::GetCurrentBitmap(). This returns the current DC bitmap object. You can then do whatever you wish with the BMP.
|
|
|
|
|
1. Create a memory DC
2. Create a bitmap object and select it into the DC
3. Draw onto the memory DC
4. Save the bitmap to file. You probably need to convert it to DIB for this to work.
There are articles at www.codeguru.com[^] www.codeguru.com written by Zafir Anjum that should help you somewhat.
Hope this helps.
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
|
RasEnumEntries() is what you need.
|
|
|
|
|
Thank you for your reply, but my DSN=Data Source Names,
EnumDataSourceNames() is what my need, but i don't know how to use it!
|
|
|
|
|
Here is a snippet of code that fills a combo box with the currently configured DSNs. Hope it helps....
void AppDB::LoadDSNComboBox()
{
CComboBox *pCB = (CComboBox *)GetDlgItem(IDC_APPDB_DSN);
CString cSelection;
GetDlgItemText(IDC_APPDB_DSN,cSelection);
pCB->ResetContent();
SQLHENV hEnv;
SQLAllocEnv(&hEnv);
char caFmt[512];
char caServerName[256];
char caDesc[256];
SQLSMALLINT iNameLen, iDescLen;
SQLRETURN iRetval = SQLDataSources(hEnv,SQL_FETCH_FIRST_SYSTEM,
(unsigned char *)caServerName,
sizeof(caServerName)-1,
&iNameLen,
(unsigned char *)caDesc,
sizeof(caDesc)-1,
&iDescLen);
while (iRetval == SQL_SUCCESS || iRetval == SQL_SUCCESS_WITH_INFO)
{
caServerName[iNameLen] = 0;
caDesc[iDescLen] = 0;
if (iDescLen > 0)
{
sprintf(caFmt,"%s [%s]",caServerName,caDesc);
pCB->AddString(caFmt);
}
else
pCB->AddString(caServerName);
iRetval = SQLDataSources(hEnv,SQL_FETCH_NEXT,
(unsigned char *)caServerName,
sizeof(caServerName)-1,
&iNameLen,
(unsigned char *)caDesc,
sizeof(caDesc)-1,
&iDescLen);
}
SQLFreeEnv(hEnv);
}
|
|
|
|
|
BTW, the flags in this example only return SYSTEM DSNs.
|
|
|
|
|
|
My bad, in a big way. Once I saw your question, I immediately put on my RAS hat. I'm glad you found the answer in spite of my faux pas.
|
|
|
|
|
Help!
I am having a problem initializing the common controls using
InitCommonControlsEx(), specifically that when I call it I am
getting Error 2 (The system cannot find the file specified.).
This is a wind32 SDK application. Other than this control,
it works. The only (potentially) pathological thing I'm trying
to do is make this control (ListBox) a child of the main
application window, but the program isn't even getting to that
point.
I am using VS.NET 2002 with the latest (Feb 03) Platform SDK.
According to depend.exe, the comctl32.dll that my program is
using is located in C:\windows\system32 and has the following
properties:
File Version: 5.82.2800.1106
Product Version: 6.0.2800.1106
Image Version: 5.1
ALSO, comctl32.lib is included in my "Link/Input/Additional Depndencies"
settings for the project. I have my global settings for VC.NET
set so that the SDK paths are searched first for lib and
include files.
Here is a code snippet illustrating the problem:
#include "main.h"<br />
#include "WindowFinder.h"<br />
#include "resource.h"<br />
#include <tchar.h><br />
#include <stdio.h><br />
#include <CommCtrl.h><br />
<br />
....<br />
<br />
BOOL InitializeApplication(HINSTANCE hThisInst, <br />
HINSTANCE hPrevInst, <br />
LPTSTR lpszArgs, <br />
int nWinMode )<br />
{ <br />
...<br />
...<br />
... <br />
(initialize wc)<br />
...<br />
if (!RegisterClass(&wc)) <br />
{<br />
return FALSE; <br />
}<br />
INITCOMMONCONTROLSEX icrtl;<br />
icrtl.dwSize = sizeof(INITCOMMONCONTROLSEX);<br />
icrtl.dwICC = ICC_LISTVIEW_CLASSES <br />
| ICC_STANDARD_CLASSES <br />
| ICC_TREEVIEW_CLASSES;<br />
<br />
if ( !InitCommonControlsEx( &icrtl ) )<br />
{<br />
DWORD err = GetLastError();<br />
return FALSE; <br />
}<br />
...<br />
}
Dr. Walter Tackett
Alden Management LP
e m a i l : walter underscore tackett at msn dot com
|
|
|
|
|
I answeed my own question. The problem is the line
| ICC_STANDARD_CLASSES
Despite what the doc says, leaving this flag out makes everything work. Also, the "standard classes" (i.e., the controls loaded by the old InitCommonControls(void) ) are loaded automatically despite not indluding this flag.
WAT
Dr. Walter Tackett
Alden Management LP
e m a i l : walter underscore tackett at msn dot com
|
|
|
|
|
How to change a font on a button using windows API?
Please help
|
|
|
|
|
1) create a font (see CFont)
2) pBtn->SetFont(&oNewFont);
|
|
|
|
|
Hi,
Is there a way to display swf's in my dialogs or views? Is there any article on this subject?
Thanks
-----
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
|
|
|
|
|
sure, find the activex flash control (you have to install it on your pc, it is usually installed when you install flash) it is quite simple to use
if you have flash (the auditing program) you can read about its functionality. i have done this last year and do not remember much but it was surprisingly easy to use
|
|
|
|
|
its too easy. Insert Shockwave Flash ActiveX control.Set its URL property, use its Play , Stop etc functions to do your job.
Muhammad Shoaib Khan
http://geocities.com/lansolution
|
|
|
|
|
When I try:
#ifdef WIN32
#include "stdafx.h"
#endif
I get an error that no matchin #ifdef was found for #endif. What's wrong with this? How can I do something like:
#ifdef WIN32
#include "windows.h"
#endif
#ifdef UNIX
#include "unix.h"
#endif
etc.
|
|
|
|
|
What error did you get?
I got no error when I tried that in VC++ ver 6.0
What compiler are you using.
Regards,
Melwyn
|
|
|
|
|
.NET
Have I forgotten to mention it?
|
|
|
|
|
This is the way precompiled headers work. If your .cpp is set to use PCHs, then the compiler looks for the #include "stdafx.h" line and ignores everything that goes before this, hence the unbalanced #ifdef .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
thanks, this makes sense now
but how to make a multiplatform program that uses precompiled headers in VS.NET?
is it impossible then? should I remove stdafx.h?
|
|
|
|
|
There was an article on DDJ a few months ago exactly about this. If I find it when I get home, I'll send you the exact month/year.
Kant wrote:
Actually she replied back to me "You shouldn't fix the bug. You should kill it"
|
|
|
|
|
ok, thanks if you send it to this email:
hr_hristov at hotmail.com
|
|
|
|
|
this is the exact error (sorry for my mistake before)it happens only with stdafx.h (precompiled header)
unexpected #endif
The #endif directive has no matching #if, #ifdef, or #ifndef directive. Be sure each #endif has a matching directive. The following sample generates C1020:
// C1020.cpp
// uncomment the below line to resolve the error
// #if 1
#endif // C1020
int main() {
}
|
|
|
|