|
I've solved the problem, I just needed to load "WININET.DLL"
HMODULE m_hWininet = LoadLibrary(_T("WININET.DLL"));<br />
and than
FormatMessage (<br />
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE,<br />
m_hWininet,dwError,<br />
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), achBuffer, 120,<br />
NULL) ;<br />
And that it's!
Thanks to all!
P.S.
Don't forget to free library after!
|
|
|
|
|
Hi i am working on a project where it is reading files (names are stored on a CArray[CS ,CS] FArray ). CS = CString and [ = < ] = >
While it Reading a file :
In each Buffer line it search if there is any word (stored in a CArray[CS,CS] WArray) int ntimes is the number that each WArray element found in Buffer Line
and the end each ntimes is stored in RArray.
Code is working perfect till ifstream TextFile
when i am adding the next code lines the .exe i build is freezing and
become (Not Responding)
if someone could see the reading code for some faults i would greatful
CArray<cstring ,="" cstring=""> RArray;
CString FilePathName;
CString LineRead ;
int ntimes=0;
const int sz =100;
char buf[sz];
m_FolderName = "C:\\test123\\";
for ( int p = 0 ; p < FArray.GetSize() ; p++)
{
FilePathName = m_FolderName + FArray.GetAt(p);
m_List.AddString(FilePathName);
ifstream FileText(FilePathName);
while(FileText.get(buf,sz))
{
FileText.get();
LineRead = (LPCSTR) buf;
for ( int m = 0 ; m < WArray.GetSize() ; m++)
{
int nStart=1;
while ( LineRead.Find(WArray.GetAt(m),nStart)!=0)
{
ntimes = ntimes +1;
nStart= LineRead.Find(WArray.GetAt(m) , nStart);
}
RArray.Add(""+ntimes);
}
}
FileText.close();
return;
}
|
|
|
|
|
|
|
hi.
I have created scrollbar in the application but the scrollbar move very slow when I clicked the two ends of the scrollbar. what should I do?
|
|
|
|
|
ReturnRain wrote: what should I do?
That depends on what you are doing in response to the WM_HSCROLL/WM_VSCROLL messages.
If you are doing a lengthy/slow operation then it's going to be slow.
Or maybe you need to scroll by a greater amount for each scrollbar unit scrolled.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi,
it can depends on your UpdateWindow () too. If you are redrawing a lot of things it can difficult other things. Just take a look if other things go slow, and try to make your code faster.
I had the same problem because I was bringing CObject derived classes and erasing them after the use. I solve my speed problem using pointers. I should not copy objects but accessing them directly.
Take a look on your code
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
How to add an image to a list ctrl. i want to add different icons for the column 1 for all the rows.
Anil Jillella
|
|
|
|
|
You have to use an Image List see here [^].
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.
|
|
|
|
|
|
http://www.boost.org/
In case you are not aware!
|
|
|
|
|
Post it in the lounge
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
this has been announced by nemanja trifunovic 3 days ago[^] on his CP blog
|
|
|
|
|
Hi. I need to create the setup.exe file for the aplication I have developed.
It works perfectly on my computer, but I want to try it on another computer to see exactly how would it work on the customer´s PC.
To know exactly which dll it needs, I have taken only the exe to the new computer and executed it. That way, the exe asks for the dll it needs. After doing with 4 dlls, when I execute the program it makes nothing. The program starts and finishes in about a half second.
I have tried to write a log to know in wich line it breaks the execution, but it nowhere after the OnInitDialog event.
I have tried to use the installshield and the Inno Setup, and it doesn´t work. A blank messagebox appears when executing the app.
I don´t know what to do, could someone help me please...?
I use Visual C++ MFC.
|
|
|
|
|
Can you more explain about your program?
|
|
|
|
|
What do you need to know?
|
|
|
|
|
Application type? does these system that you try to run your program has same OS ?
|
|
|
|
|
The app is made with MFC Wizard and the OS where I have developed it is XP. The costumer computer has 2000 OS.
|
|
|
|
|
Since you're not getting the "missing DLL" error anymore, there must be something else that is missing (or not being initialized). Two obvious things to look at are external data files and registry settings. Are all of these present on the second computer?
Also, things might be in different locations on the second computer - check if there are any hard-coded paths in the program.
Unfortunately, it sounds like there is some code that is not checking for errors (e.g., missing resources). The next step would be to look at all the code that is trying to read the registry (or a file) and make sure it is logging something if an error occurs.
If everything else fails, you might have to strip down the program to a bare minimum, and then start adding stuff back in until you find what is failing.
|
|
|
|
|
The program uses Log files, that I took to the second computer too. It also uses config files that are in the second computer, both are in the same path.
I will do what you´ve told about stripping the program. It´s a good idea. Thanks for all.
|
|
|
|
|
|
How can alow the user to enter only numbers lets say with "4" into CEditBox ! for ex: 41,42,411,42222 !!!!!!
i have tried this :
CString sCod;
m_cod.GetWindowText(sCod);
if(!sCod.Left(1).Compare("4"))
{
//something
}
else
{
AfxMessageBox("Incorect number");
}
but is not working !
please help me !
Bravoone
|
|
|
|
|
In the dialog editor right click the edit box and check the Number property to true.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Assign an integer variable to edit box.(See DDX_ )
And Use UpdateData accordingly.
Prasad
MS MVP - VC++
|
|
|
|
|
Use Dialog Data Exchange or Validate. This will not allow the user to enter anything other than number.
int iCod;
void CYourClassName::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Text(pDX, IDC_EDIT, iCod);
DDV_MinMaxInt(pDX, iCod, 0, 1000); //Third and fourth parameter is min and max value.
}
Hope this will work.
Anurag Gandhi.
|
|
|
|