|
Seems that you deleted some code to make your post shorter. Is there any UpdateData(FALSE) between the line failing and the one that works?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
No, no UpdateData(), should it make a difference ?
The assert only occurs when accessing the pointer from the DLL.
|
|
|
|
|
No, no UpdateData(), should it make a difference?
Yes, it is on the first call to UpdateData that control variables are attached their corresponding HWND s.
If you can debug into the DLL, try to check how the m_pRichEdit contents look like when the program arrives at the offending line. The fact that the call to SetWindowText is being made inside a DLL should make no difference, as far as I know.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Also, is this code in DLL? So make sure it is MFC Extension DLL and not regular. Things may work (but may not) when you are in debug build, but definately won't work if you in release.
This also can be your problem, that u have a Regular DLL and trying to pass MFC classes as function parameters
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
i have a problem using CRecordset. it return false when i call CanUpdate ().
i want to add new item inside my database but it failed because of this. it seems my database is not in write mode, but in read mode only.
i used sql server for my database. however when i use access file the CanUpdate () return true !
could any body help me. if you don't understand my problem, i can write it again clearly and detail about the problem.
|
|
|
|
|
Check your "Curser type" it must be 'dynaset' or 'dynamic'
Mazy
You can find a solution (even a foolish one) for all problems (even big ones)
|
|
|
|
|
You must define at least one index for your table; without index CanUpdate doesn't work.
By
|
|
|
|
|
How can I compare ".wav" files, by vc++ code?
Thank you
Chagit
|
|
|
|
|
What do you mean by "compare" them?
Mazy
You can find a solution (even a foolish one) for all problems (even big ones)
|
|
|
|
|
Do you want to do a binary compare of the two files to see if they are the same, or do you want to compare the files and see if they will sound similar.
If you simply want to see if the data in the two files are exactly the same, you can simply read both files into memory and perform a memcmp on both of the files. This will tell you if the data is equal.
If this is the way that you go, I would recommend that you use memory mapped files. Check out these functions: CreateFile, CreateFileMapping, and MapViewOfFile.
|
|
|
|
|
How can i launch the DUN entry dialog in program.
for an example, i have a "263 net" DUN entry in the "network connections" of "control panel", then i launch it in vc Programming.
Thanks a lot!!!!!!!!!!!!!!!!!
|
|
|
|
|
If you mean launching a connection with a specified DUN entry, see <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rras/rasclnt_1euf.asp">RasDialDlg</a> (NT/2000/XP only). To configure a DUN entry, see <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rras/rasclnt_638n.asp">RasEntryDlg</a> (NT/2000/XP only as well).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi !
I'm using the MFC for a Dialog Based App, which contains a CListCtrl in Report View.
In this CListCtrl, I would like that when I add items, the CListCtrl display them from the bottom to the top, that means, if there is only one item in the list, it will be display at the bottom of the list, and the next items will be displayed on the top of the previous item.
Does anyone know how to do this ? I tried to find if I could simply do it with a 'style' propertie, but it seems there is no propertie for that.
Thanks in advance for any help !
Jerome
|
|
|
|
|
LV_ITEM lvi;
lvi.mask = LVIF_PARAM | LVIF_TEXT | LVIF_IMAGE;
lvi.iItem = 0;//0:add head, listCtrl.GetItemCount():addTial
lvi.iSubItem = 0;
lvi.pszText = text
lvi.iImage = 0;
listCtrl.InsertItem(&lvi);
|
|
|
|
|
If I understand what you are asking you want the list items to appear at the bottom of your list like this with one item:
---------
| |
| |
| |
| |
| |
|Item 1 |
---------
And like this with 2 items:
---------
| |
| |
| |
| |
|Item 2 |
|Item 1 |
---------
If this is correct, then I beleive that you will either need to subclass the edit control and control how the items are painted into the control. This will be more than just an ownerdrawn listbox, because you will also have to change the location of the list item.
I have never tried this in the listbox, and I do not know if it is possible to change the location of a list item. In this case you would have to create an completely new control that managed all of the list elements itself.
|
|
|
|
|
error C2084: function 'void __thiscall Stock::setNumOfOutShares(int &)' already has a body
thank you !
|
|
|
|
|
If you have implemented the function in a file header, you will need to add 'inline' to the beginning of you function declaration, otherwise move the function implementation to a .cpp file.
|
|
|
|
|
can you please tell me how do i write a regular class
?
i did not have this problem be4 but when i put the class definitions(those were my .cpp files), i added them to my class declarations (.H files)
i got hundreds of errors C2084??
can you tell please tell me what is the right way to write classes?
and what do you mean by add 'inline'to the beginnig to the function?
can you give an example?
thank you so much
|
|
|
|
|
There are a number of ways to write a class. I think that how you do it depends on the current situation. Alot of times programming style simply depends on your tastes. I have developed code with alot of other people, and they all like to organize their classes in their own ways. One thing to keep in mind though, is that alot of people may see your header files if they are going to use your classes, the implementation files are rarely ever seen. With this in mind, the code that you do not want other people to see should be placed in the .cpp file.
If you have a large class with complicated implmentations I would create a header file with the class and function declarations, then place the implementations in the .cpp file.
If you class has a lot of simple get and set functions, these are good candidates for inline functions.
For instance:
<br />
class Stock<br />
{<br />
<br />
CHAR* GetName ()<br />
{<br />
return name;<br />
}<br />
<br />
};<br />
or like I suggested earlier, add the inline declaration to the function implementation.
<br />
class Stock<br />
{<br />
<br />
CHAR* GetName ();<br />
<br />
};<br />
<br />
inline CHAR* Stock::GetName ()<br />
{<br />
return name;<br />
}<br />
<br />
inline functions will make the entire piece of code that is created for the function will be compiled inline where the function would normally be called instead of actually calling the function. The only drawbacks to inline functions is that if you do it too often, the size of your program will become bloated. Use function inlining judiciously.
The reason why you get a million errors with out the inline declaration, is because every file that includes your header file recompiles the functions that should be declared inline, and when the linker tries to link all of these files it finds multiple implementations for the function. Using inline forces only one implementation.
|
|
|
|
|
here is what i want to do!
I have written all a whole bunch of classes (.h and .cpp)
using visual C++.
now i want to create a project that contains all those classes,
then i want to compile it and link it without running it(to create project.exe)
can any one give me a hint how u do that?
how do you create a project from the New dialog(there are so many options)
thanks
|
|
|
|
|
It depends on the type of project that you want. If you are simply creating a C++ project that you would like to run from the command line, you will want to select:
WIN32 Console Application
If this will be a windows program choose:
WIN32 Application
Then if it will be a windows application with ATL support choose:
ATL COM Appwizard
Or if you would like MFC support:
MFC Appwizard
you can also create DLLs in order to use your c++ classes from an external executable, in this case simply select the correct project to create the DLL for you.
You can add this project to an existing Workspace that you are working in and have multiple projects to a single workspace by checking the Add to existing workspace checkbox if that choice is available.
Say that you add all of your files into a DLL, and you want that DLL to link into another project in the same workspace, you will go into the project settings for the executable, and click the link tab. Then on the Object/libaray modules edit box, add the name of your DLL project .lib to the line. this will enable the Linker to find all of the exported items from your DLL.
If this does not answer your question please reply.
|
|
|
|
|
yeah i want to use command line!
so i guess i'll just go ahead and use the WIN32 Console Application
right?
thanks again!
|
|
|
|
|
I have a class that formats a string and I am trying to send it to the dialog class.
CNetServerDlg* pNetServer = static_cast<CNetServerDlg*>(AfxGetMainWnd());
pNetServer->PrintLog(strLogOutput);
the strLogOutput is a CString and PrintLog is a function that processes the code. The problem is that PrintLog never gets called. Is there something wrong with the above code or is something else wrong?
- Matt Newman
-Sonork ID: 100.11179:BestSnowman
Frankly AOL should stick to what it does best: Fooling millions of americans into believing that it, AOL, is the web. -Paul Watson
|
|
|
|
|
Have you stepped through with the debugger to see if your static cast is even being called? Because it seems that execution is not even reaching that point. Unless you are using exceptions and the static_cast is throwing an exception.
I need more info to answer your question.
|
|
|
|
|
What I am trying to do is create a dialog app using PJ Naughter's w3mfc class. I am converting his demo to a dialog app and can't get it to work. http://www.codeproject.com/internet/w3mfc.asp
I am trying to get PostLog to send info to my dialog. You can check out the demo if I'm not making sense.
- Matt Newman
-Sonork ID: 100.11179:BestSnowman
Frankly AOL should stick to what it does best: Fooling millions of americans into believing that it, AOL, is the web. -Paul Watson
|
|
|
|