|
Thanks for the additional information. What would you suggest in terms of trying to fix or avoid the problem?
Kim
|
|
|
|
|
The only thing I can think of, if this becomes a major problem, is to re-install windows. Not an ideal solution I know, but sometimes that is what it takes.
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
I have a class that I call from various functions, and I want to have the iterator not return to the beginning each time it starts. For example, function 1 reads in the first two vector strings. The instance of the class is then passed to another function. When it reads the next function, I want it to read the third vector string. The following does not do that. The iterator starts at the beginning of the vector in each function. Is there a way to do this?
class InputFile
{
private:
vector <std::string> theVector;
vector<std::string>::iterator pr;
public :
// InputFile();
// InputFile(std::vector<std::string> & trs);
// string getNextLine();
InputFile( std::vector<std::string> & trs )
{
theVector.resize(trs.size());
copy(trs.begin(), trs.end(), theVector.begin());
pr = theVector.begin();
}
int size( void)
{
return theVector.size();
}
string getCurrentLine( void )
{
string s;
s = *pr;
return s;
}
string getNextLine( void )
{
string s;
pr++;
s = *pr;
return s;
}
};
Thanks.
|
|
|
|
|
Is there anyone who has a sample to use the MSXML DOM
parser in a MFC application for eVC++ 3.0 on PocketPC 2002?
I have tried the last 3 days to create a sample
application ... but nothing ... so please ... I would
need a sample!
(If possible I want to use SMART POINTERS and the _bstr_t
and _variant_t classes, but I welcome all other samples I
can learn from.)
PS: Sorry for my bad english!
Thanks!
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Hello,
I was wondering if there is anyway to create some type of timer inside a CWinThread? I would like to spawn a thread and if the timer reaches a high enough number it would tell the thread to quit..
I played around with OnIdle but it seems to only get called once..
Any ideas?
Rob
|
|
|
|
|
OnIdle() gets called until the return value tells the framework not to call it anymore.
Anyway, you can create a timer using the API function SetTimer(), passing the HWND parameter as NULL so that the timer message is then sent to the thread instead of a window. You can then pick up the WM_TIMER message in the PreTranslateMessage() method of the CWinThread derived class.
e.g.
BOOL CThread::InitInstance()
{
// Every second
m_nID = ::SetTimer( NULL, 0, 1000, NULL );
ASSERT( m_nID != 0 );
return TRUE;
}
BOOL CThread::PreTranslateMessage(MSG* pMsg)
{
if ( WM_TIMER == pMsg->message && m_nID == pMsg->wParam )
{
::KillTimer( m_nID );
PostQuitMessage( 0 ); // Kill the thread
return TRUE; // We have finished processing this message
}
return CWinThread::PreTranslateMessage( pMsg );
}
Dave
|
|
|
|
|
|
Ok, I'm going to show my ignorance here so please forgive me.
Here's the problem I'm trying to solve. I've got a Dialog based application which contains a listbox and a button. I've also got some legacy C code which contains a function that I must call after the user hits the button.
So, after the user hits the button we're in a function within the C legacy code. In this function, I need to update the ListBox with information contained in a character array.
As I understand it, the only method available to me is to use a call back function. I understand the basic concept but not the syntax. I'd really appreciate it if someone could help me with the syntax required. I'm adding some basic code below to further illustrate the problem.
Thanks SOOOO much for any help you can provide!!!!
--------------------------------
//Clegacycode.c
#include mydialogapp.h
void somefunction();
void somefunction(){
//need to update the list box with "HOWDY"
}
------------------------------
//mydialogapp.cpp
.
.
.
void CMyDialogAppDlg::OnCallTheLegacyStuff()
{
somefunction();
}
|
|
|
|
|
Try something like:
typedef void (*FN_MyCallback)(void* pParam1, void* pParam2);
void somefunction(FN_MyCallback pfnCallback, void* pParam1)
{
// Do stuff...
// Callback
(*pfnCallback)(pParam1, pParam2);
// Do more stuff...
}
Dialog
void CMyDialogAppDlg::OnCallTheLegacyStuff()
{
somefunction( &CMyDialogAppDlg::LegacyCallbackStatic, (void*)this );
}
void CMyDialogAppDlg::LegacyCallbackStatic(void* pParam1, void* pParam2) // Must be static member
{
((CMyDialogAppDlg*)pParam1)->LegacyCallback( pParam2 );
}
void CMyDialogAppDlg::LegacyCallback(void* pParam)
{
// Update the display...
}
Dave
|
|
|
|
|
|
I am using a CTabCtrl, and two CListCtrl's underneath. I used the dailog editor to add them to a dialog (the tab order has the CTabCtrl as being the first item). When the dialog is initialized, I use ShowWindow() to show the appropriate list control, and hide the other. The same is done when you click on the tab control.
Everything works fine until you do one of a few things:
1. Simply re-size one of the list control's columns until a scroll bar is required.
2. Minimize, and restore the window.
Either one of these will create a redrawing problem that looks really bad. If I click on the tab control, it will clear up.
Is there something I can do to clear this up? Has anyone seen this before? I saw an article posted on another web site that describes a similar problem, but the answers were numerous and not very helpful.
Thanks,
David
|
|
|
|
|
Can't be sure, but here's a couple of things to try:
1) check the z-order of the controls on your dialog. Both list controls should be higher (later in the tab order) than the tab control.
2) if #1 fails to resolve your problem, you can set the WS_CLIPSIBLINGS style on the tab control (using ModifyStyle() for instance).
---
Shog9
This is my December
These are my snow covered dreams
This is me pretending
This is all I need...
|
|
|
|
|
I have two problems with the position of the toolbars. In my applicaton I use more than one toolbar. All toolbars are moveable and dockbale and the positions are saved in an external file. The problems are:
1. If I change the size of my parent window in the way that it is very small all my toolbars are on the left side of my application and among each other.
2. Sometimes my toolbars change their positions but I don't know under which circumstances. This happens only if I end my application or if the size of the parent window is changed. It is not reproducable. It is equal to the Visual Studio where from time to time all toolbars are reordered.
Has anyone of you an idea? It is really urgent.
|
|
|
|
|
One problem could be that you save the toolbar positions when closing the app and its minimized at the time. As doing this will give bogus positions for all the toolbars when they are saved, I think.
Also, when re-sizing the main window, the toolbars are moved usually by the MFC code if the new size causes a docked toolbar to not be able to show all its buttons.
Roger Allen
Sonork 100.10016
In case you're worried about what's going to become of the younger generation, it's going to grow up and start worrying about the younger generation. - Roger Allen, but not me!
|
|
|
|
|
There is no problem with saving the toolbar positions when closing the app minimized. The problem is that my toolbars must be moved before saving.
Example: I have 3 toolbars and the positions are
toolbar1 toolbar2 toolbar3
after closing I have always the position like
toolbar1
toolbar2
toolbar3
Only the y-values are changed. The value has exactly the hight of my toolbars. The big problem is that it happens rarely so that in general everything must be ok.
|
|
|
|
|
Hi!
I'm trying to use two diferent CFont objects to use in diferente CStatics, but one of them is never used, why does this happends, i did like :
void CUnits_Sold::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
//trata das fontes para os títulos
CFont hFont;
CFont hFontForm;
hFont.CreateFont(40, 15, 0, 0, FW_BOLD ,FALSE, FALSE, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, "MSTrebuchet");
m_stCStatic.SetFont(&hFont);
m_stCLabel.SetFont(&hFont);
m_stCMachineName.SetFont(&hFont);
m_stCTempo.SetFont(&hFont);
m_stCTempo2.SetFont(&hFont);
//cria a fonte para as letras de identificação do form
hFontForm.CreateFont(200, 14, 0, 0, 0 ,FALSE, FALSE, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, "MSTrebuchet");
m_stCFormName.SetFont(&hFontForm);
}
This hfontform is not used and the m_stCFormName uses the hFont, what am I doing wrong?
Thank you for your time
Rui
|
|
|
|
|
As soon as the CFont objects go out of scope, they are destructed. The CFont destructor destroys the GDI font objects. Make the CFont variables members of the view class.
--Mike--
"Adventure. Excitement. A Jedi craves not these things."
-- Silent Bob
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Thank you Michael Dunn, it's working!
Rui
|
|
|
|
|
Hi all,
I am using the CHttpFile wrappers class in MFC. On one of my test networks I periodically see an issue where I send a POST command to a Java Servlet on my server, and my client times out waiting for a response (about 30 seconds). However if I type the same URL into IE I get the repsonse back ok. And if I reboot my machine the POST command starts working in my client.
My question is, does anyone know of an issue with the CHttpFile classes or Internet APIs with IE that would cause this, or possibly a mistake that I could have made in using them that would cause this?
Thanks
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I don't exactly know the cause. But I suggest you to check the HTTP header and data that the client send to HTTP server.
You should make sure that your HTTP header is a correct POST header, and you POST data have the same length that you specify in POST header.
If you request is incorrect, the server will wait until it recieves the correct request. And that may be the cause that make your client doesn't recieved response from server.
And I additional suggest you that you should close the connection every time you connect to server.
|
|
|
|
|
Hi I developed an RAS software. When I run on Windows ME and later it works fine. I dont know about windows 98. But when I run it on Windows 95 it crashes when i try to delete RAS entry. Code is below. It works fine if i add one more line of MessageBox.
CRASHING CODE<br />
m_ras.DeleteRasEntry();<br />
<br />
The function looks like this.<br />
BOOL CMyRas::DeleteRasEntry()<br />
{<br />
DWORD dwResult=RasDeleteEntry(NULL,strBrand);<br />
if(dwResult!=0)<br />
return FALSE;<br />
return TRUE;<br />
}<br />
Not crashing one. This one doesnt crash else it crashes.
<br />
BOOL CMyRas::DeleteRasEntry()<br />
{<br />
DWORD dwResult=RasDeleteEntry(NULL,strBrand);<br />
TMessageBox("Out of entry");
if(dwResult!=0)<br />
return FALSE;<br />
return TRUE;<br />
}
One more thing. Program also crashes while trying to open a website by calling ShellExecute. It wasnt crashing earlier. But does now.
It doesnot crash if I call RasDeleteEntry as global.
m_ras.DeleteRasEntry();
RasDeleteEntry(NULL,m_ras.strBrand);
I have some global variables a total of going above 1.2KB . So I tried to convert one of 700 bytes to heap by calling GlobalAlloc but still it doesnt work at all. It crashes again and again.
help me plz.
THanks in advance.
In my dream, I was dorwning my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|
|
<br />
struct InterfaceA<br />
{<br />
virtual void my_interface_func() = 0;<br />
};<br />
<br />
class Class : public InterfaceA<br />
{<br />
void my_interface_func() { }<br />
};<br />
AND
<br />
class InterfaceA<br />
{<br />
public:<br />
virtual void my_interface_func() = 0;<br />
};<br />
<br />
class Class : public InterfaceA<br />
{<br />
void my_interface_func() { }<br />
};<br />
Is there any advantage in using either and if so, what is it?
Thomas
My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
modified 29-Aug-18 21:01pm.
|
|
|
|
|
a struct in C++ is a class with all member public by default.
a class in C++ is a struct with all member private( or protected, don't remember ) by default.
so, struct and class can be interchangeable! In your example, they are the same.
Max.
|
|
|
|
|
|
Thomas George wrote:
Why is it that interfaces are always structs then?
maybe because everything should be public by default.
Thomas George wrote:
Is there any performance advantage OR is it that people are lazy to write public: ?
I think the struct/class (the same for public/private/protected ) , is a compilation hint, it does not change the object ( in memory ), or the "performance" of an object.
Max.
|
|
|
|