|
|
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
|
|
|
|
|
But then the question you should ask yourself is this. Why are you building a unicode application in the first place?
|
|
|
|
|
your Character set is Unicode Character Set
<br />
LPTSTR lpc;<br />
lpc=(LPTSTR)LocalAlloc(LPTR,256);<br />
wsprintf(lpc,_T("%s"), _T("c:\\code.txt"));<br />
WIN32_FIND_DATA FindFileData;<br />
HANDLE hp; <br />
<br />
hp = FindFirstFile(lpc, &FindFileData);<br />
LocalFree(lpc);<br />
<br />
whitesky
|
|
|
|
|
hai every body i try to build the MFCAppWzd project to change the remote system user password, and get remote system current user name.please give me the procedure and code for me.
|
|
|
|
|
Start coding dear.
If you then have some problems somebody here is going to help you on that.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
this error is not show in ie 6,0 but error messge box show in ie 7.0.
I don't know why this error messagebox !!!
i wait for reply...
//////////////////////////
// problem source is this
ASSERT(pHtml != NULL);
pHtml->Navigate2(_T("http://www.microsoft.com")); // show err msg
//////////////////////////
error message is below.
"Cannot find "http://www.microsoft.com" Make sure the path of internet address is corredct."
|
|
|
|
|
whats type pHtml?
whitesky
|
|
|
|
|
|
I use like this and it work i write for you maybe its some helpful to you
<br />
m_html2=new CMyhtmlview();<br />
m_html2->Create("CMyhtmlview","CMyhtmlview",WS_VISIBLE | WS_CHILD ,<br />
CRect(0,25,390,185),this,1,NULL);<br />
m_html2->Navigate("www.microsoft.com");<br />
and i RegisterWindowClass chtmlview class
whitesky
|
|
|
|