|
Making cleanup is fundamental task the wise C/C++ programmer.
That said, when a process is terminated, the OS frees automatically the allocated memory.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
hi all,
i wrote several lines to set up a wide pen and use this pen draw lines and arcs to a screen and printer. on the screen the line width is ok, but on the screen the line is still thin with the width of zero.
static HPEN PC_hPen;
PC_hPen = CreatePen (PS_SOLID,2, RGB (255, 0, 0)) ;
SelectObject (PChdc, PC_hPen) ;
MoveToEx ( handle_dc, 1, 1, NULL) ;
LineTo ( handle_dc, 10,10 ) ;
|
|
|
|
|
on the printer the width is still zero, sorry.
|
|
|
|
|
adeshayee wrote: i wrote several lines to set up a wide pen and use this pen draw lines and arcs to a screen and printer. on the screen the line width is ok, but on the screen the line is still thin with the width of zero.
If the underlined 'screen' means 'printer' then you possibly are not aware that printers, as general rule, have more more more resolution than screens.
I.e. you need a very thick pen to notice the difference.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
adeshayee wrote: ...on the screen the line width is ok, but on the screen the line is still thin with the width of zero.
This is not the least bit contradictory.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I just heard abou Qt4. As I understand that Qt4 is used to create GUI.
but what is the advantage of Qt4 comared to Visual studio c++ 2008?
thanks.
|
|
|
|
|
Seraph_summer wrote: but what is the advantage of Qt4 comared to Visual studio c++ 2008?
Such a comparison makes poor sense.
A better one would be between MFC and QT. That said, let me google that for you.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Read here[^].
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
QT is a cross-platform framework, which means you can compile the same code for different platforms. But, MFC/Visual C++ is specific to Windows platform.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
And a lot of developers find it, as framework, better than MFC, but shhhhhhhhhh, don't tell Rajesh!
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hello:
I want to open a URL from a Visual C++ application in a default browser. This URL has a '#' character as following : file:///C:/Mydocument.html#_MySegment
I'm using the following instruction:
ShellExecute(NULL, "open", "file:///C:/Mydocument.html#_MySegment", NULL, NULL, SW_SHOWNORMAL);
The result is that the document is opened but it doesn't go to the mark "_MySegment".
Any help will be very appreciate.
Thanks in advanced!
Loli
|
|
|
|
|
Looking at this page[^] shows that ShellExecute parses the string you pass it to work out how to open it. I guess that file: protocol URLs are parsed like that to work out what file type you're passing it, and that ShellExecute just passes the filename to the browser.
I would suggest you use FindExecutable[^] to get the application associated with your HTML file and use that with ShellExecute or CreateProcess , explicitly passing your URL as a command-line parameter.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks a lot for the help.
But also if I write in a command window:
start file:///c:\myDocument.html#_myMark
I have the same problem. It doesn't open the document at the mark position.
Thanks for the help!!!!
Loli
|
|
|
|
|
Yes, because start uses ShellExecute or ShellExecuteEx .
However, if you use FindExecutable with the filename of your HTML file, you get back the executable that is registered to handle the open verb. You can then use that with ShellExecute .
For example, FindExecutable (when called on an HTML file) gives this for me (it's Google Chrome):
C:\Documents and Settings\my-user-id\Local Settings\Application Data\Google\Chrome\Application\chrome.exe
So, you can do something like this:
LPCTSTR url = "file:///C:/Documents%20and%20Settings/u404261/Desktop/a.html#plop";
TCHAR path[32768] = {0};
DWORD nChars;
if (SUCCEEDED(PathCreateFromUrl(url, path, &nChars, 0)))
{
TCHAR execName[32768] = {0};
if ((int)FindExecutable(path, "c:\\", execName) > 32)
ShellExecute(0, "open", execName, url, "c:\\", SW_SHOWNORMAL);
}
We use PathCreateFromUrl to get a Windows path from the URL, as that's what FindExecutable acts on.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi any one plese help me
i am using GetVolumeInformation in my code for comressing some files and folder.
the used code is below
CString strDir = _T("D:\\CompressionTest");
TCHAR volBuff[256];
LPTSTR lpVolumeNameBuffer = volBuff;
DWORD nVolumeNameSize = 256;
LPDWORD lpVolumeSerialNumber;
LPDWORD lpMaximumComponentLength;
LPDWORD lpFileSystemFlags = 0;
TCHAR sysFileBuff[256];
LPTSTR lpFileSystemNameBuffer = sysFileBuff;
DWORD nFileSystemNameSize = 256;
if(!GetVolumeInformation(strDir,lpVolumeNameBuffer,nVolumeNameSize,lpVolumeSerialNumber,
lpMaximumComponentLength,lpFileSystemFlags,lpFileSystemNameBuffer,nFileSystemNameSize))
{
CHAR szBuf[80];
DWORD dw = GetLastError();
sprintf(szBuf, "failed: GetLastError returned %u\n",dw);
MessageBox(NULL, szBuf, "Error", MB_OK);
ExitProcess(dw);
}
plese inform me if i am doing any mistakes
|
|
|
|
|
you are missing a trailing "\"
For eg:
CString strDir = _T("D:\\CompressionTest\\");
Error code 123 indicates:
From MSDN:
ERROR_INVALID_NAME
123 (0x7B)
The filename, directory name, or volume label syntax is incorrect.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
modified on Wednesday, April 15, 2009 5:04 AM
|
|
|
|
|
i tried trailing "\" like below
CString strDir = _T("D:\\CompressionTest\");
then its giving compilation error
D:\AcqUT\TestZip\TestZip.cpp(27) : error C2001: newline in constant
D:\AcqUT\TestZip\TestZip.cpp(27) : fatal error C1057: unexpected end of file in macro expansion
while using trailing '\'
CString strDir = _T("D:\\CompressionTest'\'");
no compilation error but mentioned problem was not resolved
|
|
|
|
|
you need to use a "\\" in the end _T("D:\\CompressionTest\\"); otherwise you are putting a escape sequence
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
chandrakar ashish wrote: CHAR szBuf[80];
DWORD dw = GetLastError();
sprintf(szBuf, "failed: GetLastError returned %lu\n",dw);
MessageBox(NULL, szBuf, "Error", MB_OK);
It's not a mistake per se, but since you are using MFC, why not have:
CString szBuf; <br />
DWORD dw = GetLastError(); <br />
<br />
szBuf.Format("failed: GetLastError returned %u\n",dw); <br />
<br />
AfxMessageBox(szBuf);
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I have the same problem, and I am not using MFC.
From several partiotins that I have, the GetVolumeInformation failed 2x.
Using the FormatMessage
char *errorBuf = 0;
if (
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(), //the error message
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &errorBuf,
0,
NULL)
)
{
MessageBox (NULL, errorBuf, "BuildIndex - Error",MB_OK);
LocalFree (errorBuf);
}
The message box says "The filename, directory name, or volume label syntax is incorrect"
But explorer shows the right label for those partitions.
So It must be another way to collect information and getting the right label.
==== EDIT ====
Never mind, I got the answer. I added '\\' to the drive name. The funny thing was, It was successfully without adding the '\\' on some partitions
|
|
|
|
|
//I reposted this message to have it appear in first page of the forum. I didn't get any reply last time, so I hope would be better this time
Hello,
I am having troubles with applying themes to my application. I have a MFC project developed under VS2008 which can by default settings change the appearance (theme) of the mainframe. It is the SDI application with splitters where I use many CformViews. The problem is that the views are not themed at all. I searched many site for solving that problem but found no answer.
- My application automaticly generate the manifest, so I don't think the problem is in that. The mainframe changes the theme.
- in my app class in InitInstance() I call
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
what I found is important for initializing the themes. It was automatically done by VS in my app.
Can you please help me to solve my problem. Do I need to change something in my views?
Thank you very much, Tomas
|
|
|
|
|
Hi,
I am working in development of Active X control in VC++ .I need to create a property for FONT to have GetFont & SetFont. I have developed with default setting when I debug the code using Activex control test container I can go GetFont function in the code when I invoke GetFont but I try for SetFont it doesn’t moves to SetFont instead it goes to GetFont.
When I check with MSDN I came to know that IFontDisp is used which is inturn inherited to IDispatch which provides write access to set function only when we set the flag DISPATCH_PROPERTYPUT.
Could any one suggest me what are the steps to be taken to move the into Setfont function.
Thanks in Advance,
G.Girish
|
|
|
|
|
What is the problem of integrating the DISPATCH_PROPERTYPUT? It is the key (but I have no clue)
ActiveX is sometimes strange
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Hello,
I am doing socket programming in VC++. I have two applications for Server and Client(in VC++). Message can be send/receive with these two applications from server to client or vice-versa.
I download one HL7 Toolkit. I want to communicate this Toolkit with my applications. They did socket programming, but in Java.
I want to know, can we send data if sender side socket is created in VC++ and on receiver side socket created in Java. Is socket programming is platform independent?
Thanks in advance
|
|
|
|
|
Yes socket programming is platform Independent.
Do not trust a computer...
Always check what computer is doing
regards,
Divyang Mithaiwala
Software Engineer
|
|
|
|
|