|
Tried after converting to TCHAR * however it is still showing wrong data.
|
|
|
|
|
how about posting some code so I/others can take a look - its a bit hard working blind !!
'g'
|
|
|
|
|
itkid wrote: Next time when i tried to get the data from the list based on bstr key, I am getting wrong data.
Sounds to me like your code is wrong. Have you tried using a wrapper like _bstr_t ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I am trying to show a gradient on the screen... the program shows the gradient and then erases it - I can't understand why. I have included the entire program - ran it under win 98, Visual C++ 6 - Can anyone help me?
#include <windows.h>
HINSTANCE hInst;
MSG msg;
LRESULT CALLBACK MainWndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow)
{
HWND MainWnd;
WNDCLASS wc;
int mx,my;
hInst=hInstance;
wc.style=0;
wc.lpfnWndProc=(WNDPROC) MainWndProc;
wc.cbClsExtra=0;
wc.cbWndExtra=0;
wc.hInstance=hInstance;
wc.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wc.hCursor=LoadCursor(NULL,IDC_ARROW);
wc.hbrBackground=(HBRUSH) GetStockObject(BLACK_BRUSH);
wc.lpszMenuName=0;
wc.lpszClassName="Black";
if(!RegisterClass(&wc)) return 1;
mx=GetSystemMetrics(SM_CXSCREEN);
my=GetSystemMetrics(SM_CYSCREEN);
MainWnd=CreateWindowEx(0,"Black","Black Screen",WS_POPUP,
0,0,mx,my,0,0,hInstance,0);
if(!MainWnd) return 1;
ShowWindow(MainWnd,SW_RESTORE);
while(GetMessage(&msg,0,0,0))
{
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK MainWndProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
{
HDC h1;
HPEN hp1;
HPEN hpa[64];
int i,mx,my,in;
switch (umsg){
case WM_NCPAINT:
mx=GetSystemMetrics(SM_CXSCREEN);
my=GetSystemMetrics(SM_CYSCREEN);
mx--;my--;
h1=GetWindowDC(hwnd);
hp1=CreatePen( PS_SOLID, 1, RGB(0,0,0));
SelectObject(h1, hp1);
for(i=0;i<=my;i++)
{
MoveToEx(h1,0,i,NULL);
LineTo(h1,mx,i);
LineTo(h1,mx-1,i);
}
ReleaseDC( hwnd, h1);
return TRUE;
case WM_PAINT:
mx=GetSystemMetrics(SM_CXSCREEN);
my=GetSystemMetrics(SM_CYSCREEN);
mx--;my--;
h1=GetWindowDC(hwnd);
for(i=0;i<=63;i++)
hpa[i]=CreatePen( PS_SOLID, 1, RGB(0,i*4,0));
for(i=0;i<=my;i++)
{
in=i*63/(my+1);
SelectObject(h1, hpa[in]);
MoveToEx(h1,0,i,NULL);
LineTo(h1,mx,i);
LineTo(h1,mx-1,i);
}
ReleaseDC( hwnd, h1);
return TRUE;
case WM_DESTROY:
PostQuitMessage(0);
return TRUE;
default:
return (DefWindowProc(hwnd,umsg,wParam,lParam));
}
}
D. Emmanuel
|
|
|
|
|
Got it... Works if GetWindowDC and ReleaseDC are replaced by BeginPaint and EndPaint
D. Emmanuel
|
|
|
|
|
Hi,
Am doing a project in vc++ win32.
How do I create a binary file using CreateFile() function. I dont see any attributes regarding that.
Thanks a lot in advance.
|
|
|
|
|
At the level of CreateFile, ALL files are binary, as your choice to write is WriteFile, which takes a pointer to a sequence of bytes.
If you want to make a Windows-compatible ASCII text file, just put a CRLF at the end of a 'line' of text, and Voila! instant text file.
|
|
|
|
|
Great! Thanks for your reply...
Also having another question. I want to create a new file if file does not exist, but if the file already exists then I want to append to the existing file. How do I do it.
I am using
hOp = CreateFile("RECORDOUT.TXT", // open OUT.TXT
GENERIC_WRITE, // open for writing
0, // do not share
NULL, // no security
OPEN_ALWAYS, // open or create
FILE_ATTRIBUTE_NORMAL, // normal file
NULL);
but it is always overwriting instead of appending.
Thanks.
|
|
|
|
|
You need to set the file pointer to the end of the file before writing to it if the file already exists. Otherwise, each time you open the file, the 'writing' will start at the very beginning of the file.
This will set file pointer to end of file, so you can 'append':
SetFilePointer(hOp, 0, NULL, FILE_END);
|
|
|
|
|
I tried to add scroll bar to the child window in a MDI.
In the mother window I modify code as below:
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style =WS_OVERLAPPEDWINDOW|WS_VSCROLL|WS_HSCROLL;////Mewly added
if( !CMDIFrameWnd::PreCreateWindow(cs) )
return FALSE;
return TRUE;
}
It works well.
However in the child windows.
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
///////////Mewly added///////////////////////////
cs.style =WS_CHILD|WS_OVERLAPPEDWINDOW|WS_VSCROLL|WS_HSCROLL;
//////////////////////////////////////////////////////////////////////////
if( !CMDIChildWnd::PreCreateWindow(cs) )
return FALSE;
return TRUE;
}
The scroll bar will appear when running the program, however it doesn't function. I can't scroll the child window at all.
I also tried the method recommended by MSDN---- "derive a new class from CMDIChildWnd and replace all references to CMDIChildWnd in your project with references to the new class." The scroll bar wont even come out. Where did I make mistake?
Anybody can help me with the simple question?
Hello, Everybody!!!
|
|
|
|
|
Hi All,
I am getting this error while bulding the project.
LINK : fatal error LNK1104: cannot open file "msxfs.lib"
And when I give path of this lib file in project settings, it is giving me 42 errors and I am sure that my code doesn't have any error.
Please tell me how to fix this error.
Thanks in advance
Preeti9
|
|
|
|
|
I think the linker would disagree with you.
However, in the interest of fairness, how about posting some of the errors so the more-experienced of us might be able to help you out
|
|
|
|
|
Iam running VS.NET beta 2 and I would like to include a variable representing the version of the executable of my application into the msi project of the application. I would like for example to define the DefaultLocation of the Application folder as follows
[ProgramFilesFolder][Manufacturer]\[ProductName][MyUserDefined_Appli_Version].
Thanks for any hint
GA
|
|
|
|
|
I don't know how to do it with Visual Studio.NET beta 2; however, you can easily do it with Orca, an utility contained in the Windows Platform SDK.
Change the DefaultLocation to your string.
To modify the MSI file with Orca:
- Open the .MSI file with Orca
- Select the Property table in the left pane
- Add a new row to the table with the property name and value that you want.
- Property: MyUserDefined_Appli_Version
- Value: (whatever value you want)
- Save the file and close Orca.
"we must lose precision to make significant
statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Thanks for the hint. It only partly solves the problem since I want to work with the variable from within the VS.Net
|
|
|
|
|
hi all,
where does explorer saves the changes of the folder?
suppose i change the view from details to icon, then closes the explorer window then re-open it, the information is stored and i see the icon view..
question is, where does it store this info?
i've searched the registry, and the desktop.ini files but couldn't figure it out...
can any1 help?
thanks
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
YaronNir wrote: question is, where does it store this info?
Try:
HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\Bags or HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Bags
I believe that each 'number' under that key represents a different folder.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Very interesting
Owner Drawn
--Nothing special
|
|
|
|
|
thanks a lot for all your help, you sure hold a great knowledge
looking at those keys, there wasn't anything there that defines a folder, couldn't find any reference that would tell me which number holds which folder?
any documentation regarding?
thanks again
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
This code does not work properly tell me the correct one
void CRichtextView::OnLButtonDown(UINT nFlags, CPoint point)
{
CFontDialog mydlg;
CTextfile dlg;
if(mydlg.DoModal() == IDOK)
{
dlg.m_rich.SetSelItalic()=mydlg.IsItalic();
dlg.m_rich.SetSelUnderline()=mydlg.IsUnderline();
dlg.m_rich.SetSelFontSize()=mydlg.GetSize();
dlg.m_rich.SetFont(mydlg.GetFont(),TRUE);
}
}
where Richtext is the project name and CTextfile is the dialog where Rich-Edit controll is placed
|
|
|
|
|
|
Are you trying to set values to controls before the dialog dlg has been created ?
If m_rich is a control in the dialog dlg , then the control needs to be created before setting values to it.
I assume that you will be doing a DoModal on the dlg dialog, because now, there's nothing going on after you assign the values to the m_rich member of the dialog.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Hi all,
Could you please give me an advice what book is only for MFC GUI learning, more examples is good for me. (Title, author and SBNI).
This book must be for Visual c++.net year 2003, because I am new and not smart to figure out to keep track what book saying for older Visual C++ version.
Thank you.
MilkyWay
|
|
|
|
|
Microsoft Visual C++ .NET 2003 Kick Start by Kate Gregory
|
|
|
|
|
Thank you. I just ordered this book.
MilkyWay
|
|
|
|
|