|
Hi all,
I am facing problem in creating a file and writing to it.
The code looks like this:
TCHAR path[50];
fpLog = fopen((LPCSTR)path,"wt+");
When i am storing some predefined path in variable path.In this case the file is not created in the directory when fopen is executed but when i directly give path e.g D:\\file.txt the file is created and written also.
May be i am wrong in executing fopen.
Regards,
|
|
|
|
|
try _tfopen without casting a TCHAR to a char
|
|
|
|
|
Maynka wrote: When i am storing some predefined path in variable path.In this case the file is not created in the directory when fopen is executed but when i directly give path e.g D:\\file.txt the file is created and written also.
Are you confusing an absolute path with a relative path?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I've draw a spline in a view whose DC is in Himetric mode using GDI+.No problem is here. But when I print this same spline, it is not placed at proper location. I've observed that all points that are use for spline drawing, remain same and DC also is in HIMETRIC mode. What I have to do to solve the problem? Do I need to change the pointlist that construct the spline for printing? If so how can I do that?
|
|
|
|
|
Assuming you have the normal printing gotchas out of the way that are typical in GDI based applications, you need to ensure the GDI+ environment does not interfere with the GDI mapping routines if you are using those instead of the GDI+ transformations.
Jonathan de Halleux has some good tips about this general topic...
Tips on printing with GDI+[^]
Specifically, set
graphics.SetPageUnit(UnitPixel);
to prevent GDI+ interference in the mapping mode stuff.
Hope this helps
|
|
|
|
|
Thanks bob16972
for your help
|
|
|
|
|
hi all
i have made an application in vc++ with mysql as database
i have face a problem that it gives a problem as unhandled exception access voilation
i use debugger but i cannot solve problem becoz debugger does not show error
it show LIBMYSQL! 10007764() and i could not understand this
please help me
hi
|
|
|
|
|
paras_s12 wrote: Wow. That has absolutely nothing related to your first post
Can you post the code that does not work ?
|
|
|
|
|
if(!mysql_query(myDB,"SELECT passowrd from login WHERE user= \'" + user + "\'")
res=mysql_store_result(myDB);
if (!res)
{
MessageBox("Could not run query");
}
row = mysql_fetch_row(res);
{
i = (int) mysql_num_rows( res );
if (i != 1)
{
MessageBox("WRONG LOGIN PLEASE TRY AGAIN"," pop. ",MB_ICONASTERISK);
mysql_free_result( res ) ;
the problem is that data is not fetched
and i think exception is due to no value in res
hi
|
|
|
|
|
So why are you not stepping through this code to find the problem? The debugger is your friend. Learn to use it.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
i want to execute some code when a dialog is destroyed, but the code in DeatroyWindow() function doesn't executes when i use EndDialog() but executes when i use DestroyWindow().
What is the diff. between these two and which should be best to use?
|
|
|
|
|
I'd go for DestroyWindow(), or OnOK, OnCancel if you are using MFC. I've never done anything with EndDialog().
|
|
|
|
|
i use EndDialog()for modal dialog boxs and DestroyWindow() for modeless dialog boxes
|
|
|
|
|
Dialog Window Created by DialogBox, DialogBoxIndirect .. should be destroyed using EndDialog. OnOk, OnCancel internally uses EndDialog.
And surely OnDestroy() will get called when EndDialog is used.
Are u using MFC?
|
|
|
|
|
DestroyWindow is something you call, not something that gets called. In MFC,
CWnd::DestroyWindow() is virtual. If you've overridden it, your override will get called at the
end of DoModal() but that doesn't make it a good place to do something when a dialog is destroyed.
That's a side effect of the way MFC does modal dialogs.
I think a better place is any time at or after you receive a WM_NCDESTROY message.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
ya... i'm too thinking that...
because i've placed code in overridden DestroyWindow() function
but it never gets called if EndDialog() method is used to close the dialog box.
|
|
|
|
|
Abhijeet Pathak wrote: but it never gets called if EndDialog() method is used to close the dialog box.
Looking at the source code, that is correct
Note that when you receive WM_NCDESTROY, child windows (controls etc) have been destroyed.
If you need access to the controls before they are destroyed, respond to WM_DESTROY which is sent
before WM_NCDESTROY.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello!
Please help me!
Whether can Windows Media Encoder read such stream:http://wm1.streaming.castor.nl/castor=castorradio
If yes that as?
If is not present, than it would be possible to read what to transfer the ambassador on processing in Windows Media Encoder?!
|
|
|
|
|
If I get press enter key message from edit control, like this:
<br />
BOOL PreTranslateMessage(MSG* pMsg) <br />
{ <br />
<br />
if(pMsg->message == WM_KEYDOWN) <br />
{ <br />
<br />
CWnd *p = GetDlgItem(IDC_EDIT1); <br />
<br />
if(pMsg->wParam == VK_RETURN && pMsg->hwnd == p->m_hWnd ) <br />
{ <br />
MessageBox("OK"); <br />
return TRUE; <br />
} <br />
<br />
} <br />
<br />
return CDialog::PreTranslateMessage(pMsg); <br />
}<br />
that's OK, but if I get press enter key message from combobox control:
<br />
BOOL PreTranslateMessage(MSG* pMsg) <br />
{ <br />
<br />
if(pMsg->message == WM_KEYDOWN) <br />
{ <br />
<br />
CWnd *p = GetDlgItem(IDC_COMBO);
<br />
if(pMsg->wParam == VK_RETURN && pMsg->hwnd == p->m_hWnd ) <br />
{ <br />
MessageBox("OK"); <br />
return TRUE; <br />
} <br />
<br />
} <br />
<br />
return CDialog::PreTranslateMessage(pMsg); <br />
}<br />
pMsg->hwnd not equals p->m_hWnd,
why?
|
|
|
|
|
Hi,
I think this is because combo box is not a single window,it is a combo of list box, edit box and combo itself.
Try CComboBox::GetComboBoxInfo() and it has three HWND handle and match the EDIT box handle as the Enter key message must have been issued from edit control.
Best regards
Rajkumar
|
|
|
|
|
As I looked at some of the examples and articles posted on this site, and trying to code a scalable server, I have a few questions about the design.
How many I/O completion ports does a scalable server usually will use? I thought about it and decided maybe 2 or more? However, most examples I saw uses just 1. Two would mean one for a thread that solely accepts new connections using AcceptEx extension function loaded using WSAIoctl, and the other for another thread that deals with overlapped send, receive and transmit.
Or is it better to have a completion port per task? Say four for new connections, send, receive and transmit each on their own thread?
|
|
|
|
|
|
Thanks for the tip, I think I finally managed to get it working, well, just a basic implementation. I got a much clearer picture of how it works in the background.
|
|
|
|
|
hai,
i am a new member..
i am doing zoom program in vc++ using buttons.
i am creating a lcd display having 240*128 pixls.
i have to zoom a wave in lcd either in right,left,up,down using these buttons.
any body please help me.
thanks in advance..
rokini.k
roki
|
|
|
|
|
Although I don't know the details of how you have implemented your lcd, a technique that might be useful is changing the mapping mode of the window (lcd). IOW, you would scale the dimensions of your current mapping mode (if your mapping mode is MM_ISOTROPIC or MM_ANISOTROPIC)...
Please, give more information, if you think you need more precise answers.
--
=====
Arman
|
|
|
|