|
Can you be more specific
and you need to using namespace Gdiplus;
whitesky
|
|
|
|
|
|
I have vs2003 and you can see MSDN for Graphics
whitesky
|
|
|
|
|
I seen the reference to ‘graphics’ and understand we are at a crossroads between systems of programming for windows. That being said ignore it and select a NULL brush before drawing the ellipse.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Hi John R. Shaw,
you said that create null brush before draw ellipse in CDC
but in graphics if you run this code you see a ellipse with one stroke
whitesky
|
|
|
|
|
we target to win95/98 and use VC6.
NULL brush, I tried it before in this way:
CBrush*pb=0;
dc.SelectObject(pb);
but the select is ignored (previous brush is still working).
any comment about null brush?
|
|
|
|
|
That's not what he meant by null brush.
dc.SelectObject(GetStockObject(NULL_BRUSH));
|
|
|
|
|
Thanks hfry, I have been away and you and others pointed out what I was saying.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
|
how to select a null brush?
|
|
|
|
|
<br />
CPaintDC dc(this);
dc.SelectObject((HBRUSH)GetStockObject(NULL_BRUSH));<br />
dc.Ellipse(100,100,200,200);<br />
<br />
whitesky
|
|
|
|
|
thx.
it works fine on screen - hope the same for printer.
|
|
|
|
|
My project was been written in VS 6, when I build it in VS 8 :
error C2872:'unary_function' ambiguous symbol.
How can I resolve this problem?
Thanks forward...
Petro
|
|
|
|
|
As a first step I would suggest googling on the topic "Breaking changes in Visual C++" and see what turns up. Between version 6 and 8 MS have increased C++ standards compliance, so some older code may well be broken.
Kevin
|
|
|
|
|
Hi,
Having a little trouble with FindFirst File function.... heres what ive got...
include "stdafx.h"
#include <string>
#include <direct.h>
//#include "dirent.h"
#include <winsock2.h>
#include <fstream>
#include <vector>
#include <iostream>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <sys/stat.h>
#include <stdio.h>
#pragma comment(lib,"ws2_32")
using namespace std;
// Stuff.......
char fileFound[256];
strcpy(fileFound, path1);
WIN32_FIND_DATA FindFileData;
HANDLE hp;
hp = FindFirstFile(fileFound, &FindFileData);
printf ("The first file found is %s\n", FindFileData.cFileName);
FindClose(hp);
The error i recieve is...
error C2664: 'FindFirstFileW' : cannot convert parameter 1 from 'char [256]' to 'LPCWSTR'
I know sometimes when compiling the error is not always what it seeems.. but have no idea..
Please help.
TIA
-- modified at 7:45 Saturday 3rd June, 2006
|
|
|
|
|
can you tell me what type of application are you working on?
MFC , Console or On something else because I tried executing your code in MFC application and apart from a very minor change I was able to get the result.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hi,
Im using Visual Studio 2005 but ive figured that part out via searching long and hard on the web... however im stuck with another problem just the same....
heres what i got for that part....
std::wstring s2ws(const std::string& s){
int len;
int slength = (int)s.length() + 1;
len = MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, 0, 0);
wchar_t* buf = new wchar_t[len];
MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, buf, len);
std::wstring r(buf);
delete[] buf;
return r;
}
#ifdef UNICODE
std::wstring stemp = s2ws(ipp); // Temporary buffer is required
LPCWSTR result = stemp.c_str();
#endif
WIN32_FIND_DATA FindFileData;
HANDLE hFind = INVALID_HANDLE_VALUE;
char DirSpec[MAX_PATH + 1]; // directory specification
DWORD dwError;
hFind = FindFirstFile(result, &FindFileData);
printf ("First file name is %s\n", FindFileData.cFileName);
My problem is i cant seem to get the FindFileData function to return a readable string...
but i need FindFileData to be string s; for example...
|
|
|
|
|
Should get it now.
strcat(result,"\0");
hFind=FindFirstFile(result,&FindFileData);
Do you get the name of the file or not?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
//ok i fixed part of it but still need to get std::string out of it...
//here is what should be a compilable version of the code fragment...
#include <windows.h>
#include <string.h>
#include <stdio.h>
std::wstring s2ws(const std::string& s){
int len;
int slength = (int)s.length() + 1;
len = MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, 0, 0);
wchar_t* buf = new wchar_t[len];
MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, buf, len);
std::wstring r(buf);
delete[] buf;
return r;
}
int main(){
string ipp="c:\\";
#ifdef UNICODE
std::wstring stemp = s2ws(ipp); // Temporary buffer is required
LPCWSTR result = stemp.c_str();
#endif
WIN32_FIND_DATA FindFileData;
HANDLE hFind = INVALID_HANDLE_VALUE;
char DirSpec[MAX_PATH + 1]; // directory specification
DWORD dwError;
hFind = FindFirstFile(result, &FindFileData);
printf ("First file name is %s\n", FindFileData.cFileName);
}
//The Return is fine i get First file name is .
//which is what i think im looking for... however
//I still to need to get the string instead of the printed .
|
|
|
|
|
what string do you need .
The filename is in FindFileData.cFileName
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
heres all i could come up with with the find filedata...
string s;
s=(FindFileData.cFileName);
cout << s;
no luck..
error C2679: binary '=' : no operator found which takes a right-hand operand of type 'WCHAR [260]' (or there is no acceptable conversion)
|
|
|
|
|
char *s=new char[255];
strcpy(s,FindFileData.cFileName);
cout<<s;
somethings="" seem="" hard="" to="" do,="" until="" we="" know="" how="" do="" them.
<b="">_AnShUmAn_
|
|
|
|
|
std::string stores char. You need to use std::wstring to store wchar_t. You probably need to read up on unicode. If it's not your intention to use unicode set your project to use multibyte character strings instead.
|
|
|
|
|
strcpy not working... researching info for converting wstring to string....
no luck yet...
|
|
|
|
|
found it...
wstring s= s;
string ssss;
s=FindFileData.cFileName;
ssss.assign(s.begin(), s.end());
cout << ssss;
Thnx for your help
|
|
|
|