<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[PunBB Forums — MSVC 6: Getting and handling new messages while in a for loop]]></title>
		<link>https://punbb.informer.com/forums/topic/8079/msvc-6-getting-and-handling-new-messages-while-in-a-for-loop/</link>
		<atom:link href="https://punbb.informer.com/forums/feed/rss/topic/8079/" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in MSVC 6: Getting and handling new messages while in a for loop.]]></description>
		<lastBuildDate>Mon, 11 Jul 2005 19:44:34 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: MSVC 6: Getting and handling new messages while in a for loop]]></title>
			<link>https://punbb.informer.com/forums/post/47608/#p47608</link>
			<description><![CDATA[<p>Well, giving the other programs time shouldn&#039;t be a problem. There is code to make it the lowest priority process already...</p>]]></description>
			<author><![CDATA[null@example.com (Gary13579)]]></author>
			<pubDate>Mon, 11 Jul 2005 19:44:34 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/47608/#p47608</guid>
		</item>
		<item>
			<title><![CDATA[Re: MSVC 6: Getting and handling new messages while in a for loop]]></title>
			<link>https://punbb.informer.com/forums/post/47580/#p47580</link>
			<description><![CDATA[<p>there&#039;s stuff you can put in the loop to update/keepalive the giu in windows ... I used it when I did some C# stuff ... just that I&#039;ve forgotten what the commands were (and I also think a 1ms sleep in the loop will make other programs get time aswell)</p>]]></description>
			<author><![CDATA[null@example.com (Frank H)]]></author>
			<pubDate>Mon, 11 Jul 2005 17:17:30 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/47580/#p47580</guid>
		</item>
		<item>
			<title><![CDATA[Re: MSVC 6: Getting and handling new messages while in a for loop]]></title>
			<link>https://punbb.informer.com/forums/post/47577/#p47577</link>
			<description><![CDATA[<p>Now maybe you could give me WORKING code <img src="https://punbb.informer.com/forums/img/smilies/tongue.png" width="15" height="15" alt="tongue" /><br />I don&#039;t know much about C++, let alone threads..</p><p>Also, I found a few files on my HDD called stdafx.h, but none of them worked and let this program compile.<br />I will upload the entire source code soon...</p>]]></description>
			<author><![CDATA[null@example.com (Gary13579)]]></author>
			<pubDate>Mon, 11 Jul 2005 17:02:45 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/47577/#p47577</guid>
		</item>
		<item>
			<title><![CDATA[Re: MSVC 6: Getting and handling new messages while in a for loop]]></title>
			<link>https://punbb.informer.com/forums/post/47548/#p47548</link>
			<description><![CDATA[<p>Put the loop in a new thread</p><br /><div class="codebox"><pre><code>//Thready.h
#include &quot;stdafx.h&quot;


class Thready {
protected:
    bool terminateThreadFlag;
    HANDLE threadHandle;

public:
    Thready();

    void begin();

    void end();

    virtual void threadProc() = 0;
};
#endif</code></pre></div><div class="codebox"><pre><code>//Thready.cpp
#include &quot;Thready.h&quot;

Thready::Thready() {
    terminateThreadFlag = false;
    threadHandle = NULL;
}


void Thready::end() {
    terminateThreadFlag = true;

    WaitForSingleObject(threadHandle, INFINITE);
}


void WindowsThreadFunction(Thready* theThread) {
    theThread-&gt;threadProc();
}



void Thready::begin() {
    terminateThreadFlag = false;
    threadHandle = CreateThread(NULL,0, (LPTHREAD_START_ROUTINE) WindowsThreadFunction, this, 0, NULL);
}</code></pre></div><div class="codebox"><pre><code>//somefile.h
#include &quot;Thready.h&quot;
class MyClass : public Thready {
    public:
           Myclass();
    private:
            void threadProc();
      };</code></pre></div><div class="codebox"><pre><code>//Somefile.cpp
#include &quot;somefile.h&quot;
MyClass::MyClass() {
    //Penis
}
void MyClass::threadProc() {
//Do loop
}</code></pre></div><div class="codebox"><pre><code>//Main.cpp
#include &quot;somefile.h&quot;;
MyClass t;
SomeStartFunction () {
t.begin();
}</code></pre></div><p>Or something like that... I&#039;m a c++ newb <img src="https://punbb.informer.com/forums/img/smilies/wink.png" width="15" height="15" alt="wink" /></p>]]></description>
			<author><![CDATA[null@example.com (Mediator)]]></author>
			<pubDate>Mon, 11 Jul 2005 00:46:18 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/47548/#p47548</guid>
		</item>
		<item>
			<title><![CDATA[MSVC 6: Getting and handling new messages while in a for loop]]></title>
			<link>https://punbb.informer.com/forums/post/47547/#p47547</link>
			<description><![CDATA[<p>Okay, first time I have actually asked for help on this project, and I will probably find the answer in a few minutes, but oh well..</p><p>I am converting the program Rainbow Crack to use a Windows GUI, and have it mostly working, but there is one problem I am having.<br />When I am in the for loop that generates all of the hashes, I need it to check to see if there are any new messages. If I don&#039;t do this, then a user cannot press any buttons (stop, pause, etc.), and it causes Windows to list the program as unresponsive.</p><p>I tried using <br /></p><div class="codebox"><pre><code>if (GetMessage(&amp;Msg, NULL, 0, 0) &gt; 0) {
    TranslateMessage(&amp;Msg);
    DispatchMessage(&amp;Msg);
}</code></pre></div><p>I tried this, but I assume that TranslateMessage or DispatchMessage is exiting the huge for loop that I need it to stay in, so when I run it, the table file is made, and then it just stops the for loop (the file stays at 0kb).</p><p>If you don&#039;t know what Rainbow Crack is, just pretend this is a program that is in a huge for loop, and makes a file bigger every second <img src="https://punbb.informer.com/forums/img/smilies/tongue.png" width="15" height="15" alt="tongue" /></p>]]></description>
			<author><![CDATA[null@example.com (Gary13579)]]></author>
			<pubDate>Mon, 11 Jul 2005 00:10:11 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/47547/#p47547</guid>
		</item>
	</channel>
</rss>
