|
Not sure if I'm suppose to reply or not but oh well...
Thanks for the help. I looked at it and it gave me another idea. Since I was controlling the format of the input file, I just decided to have a word then '\t' delimiter then num1 tab num2 tab num3 endl
Here's what it looked like codewise:
while(getline(input1, word, '\t')) //reads the first line of input until the first tab delimiter is found
{
input1>>num1>>num2>>num3; //inputs the numbers associated with the word respectively
if (word == "Total") //Total is a separate data set that needs to be kept away from rest of data
{
total1+=num1;
total2+=num2;
total3+=num3;
}
else
{
wordCount[word] += num1; //take the word and if new add it to the maps
single[word] += num2; //otherwise if word already exists just update the count
compound[word] += num3;
}
getline(input1, word, '\n'); //formatting trick so that the endline delimiter wouldn't become new word
}
--------------------------
I'm new to programming and still learning so I am open to any suggestions or comments you or anyone else may have.
Once again thanks.
|
|
|
|
|
You didn't need to answer, but it is always good to know that something was helping
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?
|
|
|
|
|
Hello good people! How are you doing?
Well, I need some help here and maybe someone could help me.
I'm tryng to do something like a VuMeter (like this one), but my control have a bitmap as background and need to be 'covered' and 'uncovered' depending of the value. Something like a layer above the bitmap.
I use
<br />
CDC::SelectObject(&my_bitmap);<br />
to set the bitmap as background.
I don't have much experience in GDI or device context, and if someone have some code example or something it'll be really helpfull.
Thanks!
Best regards!
-- modified at 15:23 Tuesday 17th July, 2007
|
|
|
|
|
Ops... I get it!
Minutes after post this message I made some changes in my code and everything works fine.
Thanks everyone!
|
|
|
|
|
Hi all.
Due to an upgrade to Vista, I'm also upgrading my projects from VC++ 6.0 to VC++ 2K5. I have a strange problem, probably due to my limited knowledge of Vista / VC++ 2K5.
Say I have this code compiled with VC++ 6.0:
CDialog* pDialog = NULL;<br />
try<br />
{<br />
pDialog->Detach();<br />
}<br />
catch(CException* e)<br />
{<br />
e->Delete();<br />
}<br />
catch(...)<br />
{<br />
}
No problem at all, the exception is handled. If I compile the same code with VC++ 2K5, I get a second chance exception. Both in debug en release versions. How come?
-----------------------
"Hey, Eddie, can I pour you a beer?"
"A little early, isn't it, Richy?"
"For a beer?"
"No, for stupid questions."
|
|
|
|
|
If you want to catch SEH exceptions like that (the C++ way) then you can enable it...
Project/Properties/C++/Code Generation/enable C++ exceptions
set to Yes with SEH exceptions (/EHa)
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
Thanks. Works with that option.
Actually, that's kind off silly. The code clearly states I want to catch exceptions. It makes no sense that you also have to enable an option to do what you've written in code.
Hope there aren't many of these pitfalls. Any article on stuff like this so I can educate myself?
-----------------------
New and improved: kwakkelflap.com
"Hey, Eddie, can I pour you a beer?"
"A little early, isn't it, Richy?"
"For a beer?"
"No, for stupid questions."
|
|
|
|
|
|
Hello
I find that when I double-click a .dsw file (VC++ 6.0 workspace) it will launch VC++ 6.0 and open it as expected.
However if I double-click a second .dsw file while the first is still open, it reuses the first VC++ instance (effectively closing the first one) instead of spawning a second VC++ process thereby having two (which is what I want). In the end I have to remember to first start VC++ 6.0 and then open the workspace to prevent the closing of my first workspace.
I notice that this behavior does not occur with Visual Studio.NET (2003 anyways).
I did check all options and settings in VC++ 6.0 as well as the online product documentation here (to no avail):
http://msdn2.microsoft.com/en-us/library/aa468126.aspx[^]
Might anyone know how I can change things such that a new instance of VC++ 6.0 is started when a .dsw file is dbl-clicked when there is already a workspace open?
Thanks !
Sincerely,
Christopher Brack
|
|
|
|
|
Even I am interested in knowing how
Thammadi
|
|
|
|
|
Hi All,
I have an existing ActiveX DLL (Project in Visual Studio 6.0), I want to convert it to ActiveX EXE, I want to do it in VS 6.0 only, what is the best way to do that?
Please help me on the same.
Thanks,
Anand.
|
|
|
|
|
Anand Todkar wrote: ActiveX EXE
Uuh ?? What is an ActiveX exe ??? You mean you want to have a plain standard application ?
What does this ActiveX do ? And what are you trying to do exactly ?
|
|
|
|
|
Ok.. Forget ActiveX .. Is it possible to convert DLL created in V.S. 6.0 to EXE ??
Thanks,
Anand.
|
|
|
|
|
Hello!
I want to know that is possible to code a simple DLL, and when it´s loaded in a program, it will check for other loaded DLLs, and do simple actions, based on the loaded dlls, like send a msgbox, etc.
Example:
Program is running ( with the sample DLL that checks for my.dll ) -> my.dll is loaded by the program -> sample DLL will check that my.dll is loaded by the program and send a msgbox ("Hi, the my.dll is loaded by the program" ).
Anyone can post or link to example compilable source on how to do this?
Thanks in advance!
Chris Christian
|
|
|
|
|
Look at this article here
It is mainly about how to get loaded DLL reference counts, but it talks about a structure containing the "linked list of loaded modules", so it should help you with your problem
Hope this helps!
--PerspX
"Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
|
|
|
|
|
Reading the article now. Thanks for the help.
Chris Christian
|
|
|
|
|
You're welcome, Chris
--PerspX
"Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
|
|
|
|
|
Hello,
I have written a program using Visual C++ (derived from CDialog) that takes in a very large file and parses the information within the file into variables. So far, no problems with that. Due to the size of the file, this takes a few minutes to complete so I added a progress bar to my dialog to show that it is processing. Once I hit the button to begin the parse, everything works fine. The progress bar begins to grow, and the file is being parsed correctly.
Here lies my problem:
If I click anywhere on the screen and cause my dialog to lose focus, the GUI of the dialog freezes and no long responds. The parse still works correctly after I have clicked on the screen. My GUI begins to respond again once the parse function has completed.
I would just like to know how to remedy this problem? Thanks.
|
|
|
|
|
This sounds like a job for a worker thread.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
theallmightycpd wrote: I would just like to know how to remedy this problem?
you need either a classic "message pump" or you need to put the file reading into a worker thread that posts status messages back to the UI
|
|
|
|
|
Alright, so I had a feeling I would have to implement a worker thread. My problem is that within that thread, I need to be able to update my progress bar constantly and I know that you're not supposed to touch your GUI controls from within the worker thread. I understand that the work around is to use SendMessage() or PostMessage().
My code within my worker thread looks as follows: (m_prg is my progress control)
.
.
.
CStdioFile f1;
if( !f1.Open( pFileName, CFile::modeRead ) )
{ /* error */ }
int totSize = f1.GetLength();
m_prg.SetRange32(0, totSize); <--GUI freezes here
int curSize = 0;
m_prg.SetPos(curSize);
.
.
.
What I've got so far is that every time I want to call m_prg, I need to do it through SendMessage() or PostMessage(). The thing is that I know nothing about these functions. How do I implement them? I can't seem to figure it out.
Help would be greatly appreciated. Thanks.
|
|
|
|
|
|
The CProgressCtrl methods you are using use SendMessage to send the appropriate message to the
control.
I'm not sure why this is freezing the UI where you indicate, but if you want to try PostMessage,
then use it instead of calling the CProgressCtrl method.
For example:
//m_prg.SetRange32(0, totSize);
::PostMessage(m_prg, PBM_SETRANGE32, (WPARAM) 0, (LPARAM) totSize);
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
If you choose the classic message pump route, there's an example of an MFC message pump
here[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
Maybe if you use of progress on the timer your problem will be solve.
|
|
|
|