|
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
|
|
|
|
|
If you call Webbroswer Control's Navigate2 function directly in another thread, CWnd-derived object is not thread safe.
Call it indirectly.(use PostMessage)
|
|
|
|
|
My Application:-
In my Application my output window color settings changes according to my windows(My Computer display) settings . i used buttons in my window
on that button i put a bitmap .
My Problem:-
When i changed windows display settings , all color of my application output window changes according display color .BUT " button's bitmap color not changing according to windows display settings" .
plz give solution that my bitmap color of button also change a according to windows settings
|
|
|
|
|
sahaja_p wrote: When i changed windows display settings , all color of my application output window changes according display color .BUT " button's bitmap color not changing according to windows display settings" .
plz give solution that my bitmap color of button also change a according to windows settings
I think the problem is due to windows changes the color settings of the standerd controls not Custom controls
As you used the ownerdraw button and set bitmap ....
you may provide the themes for your buttons so that with the help of current theme you can change the button bitmap dynamically...
hope you get any information from this post.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
How do we set theme to button..?
|
|
|
|
|
This will help you >
http://www.codeproject.com/buttonctrl/choverbitmapbutton.asp?print=true
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I will probably not follow this up, but what is the problem.
If I place a bitmap on a control (or whatever), I want it to display the same on all systems. If the display settings change then the only thing that should change is the background color.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
hare wnen i included "Themelib.h" file in stdafx.h then iam getting a error in ThemeLib.h that <uxtheme.h> no such file or directory
Now any files aslo inlude to avoid that exception ? and give me clear idea for that
|
|
|
|
|
Hi, I have been trying to learn how to use Direct3D, but I keep running into problems. After scratching my head for a while, and using the OutputDebugString() function, I found out that it was my message loop not branching correctly. It seems that PeekMessage is always returning true so I never get to the block of code that renders to the screen. I can't figure out how to fix the problem though; I was wondering if anyone here has any idea. BTW, I use a wrapper class to hold all my D3D code, thats what the g_Screen.render(); statement comes from.
#include "display.h"
const char g_szClassName[] = "Sandboxdx9";
Display g_Screen;
bool isrendered = false;
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE prevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
WNDCLASSEX wc;
HWND hwnd;
MSG msg;
wc.cbSize = sizeof(wc);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = NULL;
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = g_szClassName;
if(!RegisterClassEx(&wc))
{
OutputDebugString("Window Registration failed!\n");
return E_FAIL;
}
hwnd = CreateWindowEx(0, g_szClassName, "Sandbox", WS_POPUP | WS_SYSMENU | WS_VISIBLE,
0, 0, 640, 480, NULL, NULL, hInstance, NULL);
if(hwnd == NULL)
{
OutputDebugString("Window Creation failed!\n");
return E_FAIL;
}
if(g_Screen.init(hwnd) == false)
{
OutputDebugString("D3D initialization failed!\n");
return E_FAIL;
}
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
ShowCursor(false);
memset(&msg,0,sizeof(msg));
while(TRUE)
{
if(PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
{
if(msg.message == WM_QUIT)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{
isrendered = true;
g_Screen.render();
}
}
if(isrendered)
OutputDebugString("It rendered.\n");
else
OutputDebugString("It didn't render.\n");
UnregisterClass(g_szClassName, wc.hInstance);
return (int)msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_CREATE:
{
}
break;
case WM_DESTROY:
{
PostQuitMessage(0);
}
break;
case WM_CLOSE:
{
PostQuitMessage(0);
}
break;
case WM_PAINT:
{
}
break;
case WM_KEYDOWN:
{
switch(wParam)
{
case VK_ESCAPE:
{
PostQuitMessage(0);
}
break;
}
}
break;
default:
{
return DefWindowProc(hwnd, msg, wParam, lParam);
}
break;
}
return 0;
}
|
|
|
|
|
Alright this is my second attempt to write a reasonable answer. Do not depend on PeekMessage to return false before your render a screen image. If you are going to make decisions at this level, then you should be making them based on messages. If the function PeekMessage is returning false, then you should be exiting the program.
You caught me off guard with the C level code, but I believe what I stated is correct because I programmed at that level for several years.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|