|
Most of VC.NET is backwards compatible with VC 6.0.
However, they have tried to make it more standards-compliant. You will get warnings about some code that is non-standard and deprecated. For example, they deprecate the use of "old" IOStreams. So if you have code that does this:
#include <iostream.h>
...
cout << "Hey there!";
You will get a warning. You should replace it with the "new" IOStream headers:
#include <iostream>
...
std::cout << "Hey there!";
Also, it is possible (via the Preferences dialog) to force "for" loops to conform to the C++ standard (finally!), for example, you can get this standards-compliant code to compile (in VC 6 it would not):
for(int i = 0; i < somenum; i++)
...
for(int i = 0; i < someothernum; i++)
...
"When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity." - Albert Einstein
|
|
|
|
|
I have a program that creates some icons and start menu items. There have been problems in the past about the start menu and desktop not always refreshing, so to make sure everything refreshes properly, we have this code:
DWORD dwTmp;
SendMessageTimeout(HWND_BROADCAST, WM_PAINT, NULL, NULL, SMTO_BLOCK|SMTO_ABORTIFHUNG, 2000, &dwTmp);
Up until now, this has always worked. However, if the Find window in XP is open (you know, the one with the dog), Explorer crashes.
Any ideas? Is there a better way that I can ensure desktop and start menu items appear correctly in XP (I have no moral or ethical problems with doing something along the lines, if(XP) doThis(); else doItTheOldWay();
"When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity." - Albert Einstein
|
|
|
|
|
Well I'm not sure about the crash, but if I were you I'd try using SHChangeNotify to notify Explorer of changes. You can probably pass SHCNE_CREATE (to say you created some non-folder items) or SHCNE_UPDATEDIR (to say you changed the contents of a directory) for the flags. I've never tried it though, so I can't guarantee it will work.
Chris Richardson Terrain Software
|
|
|
|
|
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?
|
|
|
|