|
[d3m0n] wrote:
...please tell me where you found this information...
See here.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hi
how can i look for a file if it exists without using fopen
/\|-||\/|/\|)
|
|
|
|
|
here's a function that I put in one of my programs to make sure a folder existed, but you could also use it for a file.
BOOL FolderExists(CString strFolderName)
{
return GetFileAttributes(strFolderName) != INVALID_FILE_ATTRIBUTES;
}
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
|
Try this:
bool fileExists(LPCTSTR filepath)
{
return (_taccess(filepath, 00) == 0);
}
Hope that helps,
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
|
Another way:
<br />
WIN32_FIND_DATA wfd;<br />
<br />
HANDLE hFind = FindFirstFile(csFilePath, &wfd);<br />
if (hFind != INVALID_HANDLE_VALUE)
... <br />
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
|
Try one of the stat functions, e.g.
int stat (const char *path, struct _stat *buffer);
|
|
|
|
|
PathFileExists can help tooo
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi
I have developed an application using the CBannerStatic class. For this I have used example given at : http://www.codeproject.com/staticctrl/bannerstatic2.asp
What I want is when I create EXE and run it, it should show the scrolling text. And I am statically adding the text at InitDialogue() function.
For this I am using a static control so display text. Now I want to show that static control into the size that user defines...Is there any way to dynamically change the size and position of the static control ?
Also I want to write a function such that if some one presses "ESC" key it will terminate the application. For this I have used ON_WM_CHAR, ON_WM_KEYDOWN but it's not working according to that any idea why it happens ?
Your kind help will be much important for me....
Regards
Amarelia Maehsh
Gujarat
India
|
|
|
|
|
Amarelia wrote:
For this I am using a static control so display text. Now I want to show that static control into the size that user defines...Is there any way to dynamically change the size and position of the static control ?
Sure, just use MoveWindow() or SetWindowPos() .
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hi,
I have a Dialog based MFC app that is opening a modeless dialog. When I try
to minimize this window it minimizes to a small window just above the Start
button. Is there a simple way to make it minimize so that it appears in the
taskbar instead?
TIA,
Bob
|
|
|
|
|
When using laser printer to print, there is always a margin on the paper.
How to get the size of the margin?
How to ignore the margin, i mean, make my print CDC full scaled to the paper. In other way, which function in MFC printing is to set the printing CDC size.
Thanks!
|
|
|
|
|
Hi eveeryone,
I'm creating scheduling app like MS Outlook. I need some tip or algorithm for arranging events in timeline without overlaping like Outlook does.
Best regards,
Alex
|
|
|
|
|
When I use the API in a DLL project, I got an error:
HANDLE hPrinter = NULL;<br />
PDEVMODE pDevMode = NULL;<br />
char szPrinter = {"HP LaserJet 9050 PCL 6"};<br />
<br />
BOOL bOpen = ::OpenPrinter(szPrinter, &hPrinter, NULL);<br />
if (!bOpen || hPrinter == NULL) return;<br />
<br />
long nSize = ::DocumentProperties(NULL, hPrinter, szPrinter, NULL, NULL, 0);
DWORD dwErr = GetLastError();<br />
if (nSize < 0)<br />
{<br />
::ClosePrinter(hPrinter);<br />
return;<br />
}<br />
<br />
pDevMode = (PDEVMODE)new char[nSize];<br />
if (pBuffer == NULL)<br />
{<br />
::ClosePrinter(hPrinter);<br />
return;<br />
}<br />
<br />
memset(pBuffer, 0, LENGTH_DEVMODE);<br />
long nReturn = ::DocumentProperties(NULL, hPrinter, szPrinter, pDevMode, NULL, DM_OUT_BUFFER);<br />
::ClosePrinter(hPrinter);<br />
if (nReturn < 0)
return;
1.On Windows XP system:
if nSize = 6132, the last error will be 0, and print will succeed.
if nSize = -1, the last error will be 1114, and print will fail.
After "DocumentProperties()", the last error maybe 0 and sometimes maybe 1114. 0 means success while 1114 means "A dynamic link library (DLL) initialization routine failed".
2.On Windows 2000 professional I never got the error.
How can I avoid to fail to print?
|
|
|
|
|
baogangfeng wrote:
On Windows XP system, sometimes the value of nSize(size of the buffer) is -1...
You should be calling GetLastError() to find out why.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Yes, I have done so.
1.On Windows XP system:
if nSize = 6132, error will be 0, and print will succeed.
if nSize = -1, error will be 1114, and print will fail.
After "DocumentProperties()", the last error maybe 0 and sometimes maybe 1114. 0 means success while 1114 means "A dynamic link library (DLL) initialization routine failed".
2.On Windows 2000 professional I never got the error.
What can I do?
|
|
|
|
|
hiho@ll
i'm using OnLButtonUp to get the coordinates of a mouseclick
the problem:
OnLButtonUp from MSDN: Specifies the x- and y-coordinate of the cursor. These coordinates are always relative to the upper-left corner of the window
so i thought using GetWindowRect and just adding the values point.x+=rect.left AND point.y+=rect.top will convert the relative coordinates to absolute
the problem is
for example if my window is in the middle of the screen and i click on the top of the screen (the absolute y position should be between 0 or 10)
i get an relative point.y coordinate -22!!!!
which means i clicked 22 pixel above my window? but i clicked a few hundred pixels above my window!
so how can i convert the relative coordinates to absolute?
|
|
|
|
|
I think you need to be using ClientToScreen. For example:
CPoint ptScreen = point;<br />
ClientToScreen (&ptScreen);<br />
Hope that helps, 'bod.
|
|
|
|
|
|
ThinkingPrometheus wrote:
so how can i convert the relative coordinates to absolute?
Use Api ScreenToClient() and ClientToScreen() , for more info consult MSDN.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
I already designed a dialog to send message to another PC using IP address.I already write the send site code but I do not know how to test it. Izit using cable to connect or...... can someone help me..
|
|
|
|
|
Hello,
You can create a stub process that listens on the port you send the data to. This stub process verifies a certain byte order to arrive.
On your dialog side, determine which data you want to send. This data will be verified by the stub process.
The two processes can only be on the same machine if you send on a different port than the stub process recieves.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
there's no need to connect another PC to test a dialog between two processes (one client and one server). you can just use the local loop :
127.0.0.1 or \\localhost
cheers,
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|