|
edit - screwed up the link - edit
Little Setup Builder[^]
Completely free and works very well.... a least for me.
...
|
|
|
|
|
I would go with John M. Drescher suggestion (InnoSetup), which is very simple to use.
Also Windows has an installer and this is the website [^].
Also, check your Visual Studio CDs because it has InstallShield somewhere, and there is also a tutorial on how to use it here in CodeProject.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
first of all .. thank you guys for the fast reply
I worked with the InnoSetup program. The program was exactly what i was searching for. Nice done!
Greetings
Jens
|
|
|
|
|
hey guys, i've seem to have one problem with 'InnoSetup'.
I've added to script that install has to make a desktop shortcut. After install, i open the shortcut. The program launches.
But then i get an error (error opening database file).
'Can not find c:\..\desktop\....db' file
The program searches in the directory where the shortcut is made!
It needs to search the database file in the same directory where the program executable really is (not where the shortcut is).
The same happens when i open the shortcut on start-menu. It searches the database files where the start menu group is located at.
The strange this is .. if i make a shortcut from my program to the desktop, i don't get this error and program is executed correctly.
Anyone who can fix this problem?
Greetings
Jens
|
|
|
|
|
I need to see the packets that pass my computer and filter out certain ones by ip address and port and data size, and then i have to stop them from arriving to the application they were meant for, how on earth can i do this???? There must be a way.. like hooking?? But i'm not sure..
All i ever hooked was the keyboard input so.. i'm not an expert on it.
I just need to know if its possible, and how (like the hooking). Most firewalls can block a given ip or port so they must use some similar technique, anyone know what it is?
Thank you
Kuniva
--------------------------------------------
|
|
|
|
|
firewall applications like ZoneAlarm generally use:
1) an TDI filter driver (WinDDK)
2) service to communicate with driver(VC++ 6.0)
3) user interface
Hush,hush...
thought I heard you call my name now.
Kula Shaker.
Amit Dey
Latest articles at CP - Writing Word addins
Office addin
|
|
|
|
|
Thanks, now at least i know what i'm up against
Kuniva
--------------------------------------------
|
|
|
|
|
|
Hello,
I was wondering if I spawned 50 UI threads in a loop if 2 of the threads started with the same thread ID would this cause the one of the threads to deadlock? I was doing some testing and it looked like 2 of the threads spawned with the same ID. Is this normal or just a fluke? Maybe one of the threads exited before the one with the same ID started, I didn't check that so it's a possibility..
The reason I'm asking is I was going to use the thread ID as a unique identifier but if 2 or more spawn with the same ID this will mess up my logic.
Thanks,
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
I don't believe it is possible for an application to spawn two threads with the same id unless a hardware or software bug caused an intermittent failure.
John
|
|
|
|
|
Thanks for your help.
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
The only way this could be possible is if one thread terminated before the other began. One possibility is to create all the threads suspended. (I'd also use the handle as the unique identifier--it's so useful for other things while the thread ID isn't.)
(Another problem is running 50 UI threads. I'd reexamine your logic there.)
|
|
|
|
|
Thanks, I just said 50 UI threads to help the example make sense.. I dont really spawn that many threads.
Thanks for the reply
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
how can I check to see if I set the processaffinity correctly?
|
|
|
|
|
Hi
The function is declared as
BOOL SetProcessAffinityMask(HANDLE hProcess, DWORD_PTR dw ProcessAffinityMask)
the return value ist nonzero if the function succeeds, if the ret-val zero call GetLastError().
An other way is:
1) call SetProcessAffinityMask(...)
2) call GetProcessAffinityMask(ProcessHandle[in], ProcessAffinityMask[out], SystemAffinityMask[out])
3) verify your set_mask with the get_mask
Regards
Frank
|
|
|
|
|
Take a look at the C++ program below, how could I produce a story from the 20 random "nonsense" sentences using the second noun of the first sentence as the first noun in the second sentence ( i.e. --> 1. The cat ran over the boy. 2. Some boy jumped into any town. 3. Any town went under some mouse. )
//Random generator of "nonsense" sentences & story
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <cctype>
using std::cout;
using std::endl;
using namespace std;
const int SIZE = 1000;
//Function Prototypes
int displayMenu();
void displaySentences();
void displayStory();
int main()
{
//Declare variables for menu
int menuChoice = 0;
//display menu and get choice
menuChoice = displayMenu();
while (menuChoice != 0)
{
if (menuChoice == 1)
displaySentences();
else if (menuChoice == 2)
displayStory();
else
cout << "Invalid menu choice" << endl;
cout << endl << endl;
//end ifs
menuChoice = displayMenu();
} //end while
return 0; // indicates successful termination
} // end main
//******** End of Program defined Functions ************
int displayMenu()
{
//declare variables
int choice = 0;
//display options
cout << "Options:" << endl << endl;
cout << "0 Exit Program" << endl;
cout << "1 Display Sentences" << endl;
cout << "2 Display Story" << endl;
cout << endl;
cout << "Enter menu option: ";
cin >> choice;
cin.ignore(1); //consume Enter key
return choice;
} //end of displayMenu function
void displaySentences()
{
//initialize article array
const char *article[5] =
{ "the", "a", "one", "some", "any" };
//initialize noun array
const char *noun[10] =
{ "boy", "girl", "dog", "town", "car", "man", "woman", "cat", "mouse", "boat" };
//initialize verb array
const char *verb[5] =
{ "drove", "jumped", "ran", "walked", "skipped" };
//initialize preposition array
const char *preposition[5] =
{ "to", "from", "over", "under", "on" };
//to hold the sentence
char sentence[ SIZE ] = "";
// loop through and make 20 random sentences out of the given array
for ( int v = 1; v <= 20; ++v )
{
// uses function strcat to concatenate random sentences
strcat( sentence, article[ rand() % 5 ] );
strcat( sentence, " " );
strcat( sentence, noun[ rand() % 10 ] );
strcat( sentence, " " );
strcat( sentence, verb[ rand() % 5 ] );
strcat( sentence, " " );
strcat( sentence, preposition[ rand() % 5 ] );
strcat( sentence, " " );
strcat( sentence, article[ rand() % 5 ] );
strcat( sentence, " " );
strcat( sentence, noun[ rand() % 10 ] );
// print the current sentence
cout << static_cast< char > ( toupper( sentence[ 0 ] ) )
<< &sentence[ 1 ] << ".\n";
// reset the sentence
sentence[ 0 ] = '\0';
} // end for loop
cout << endl;
} // displaySentences function
void displayStory()
{
//initialize article array
const char *article[5] =
{ "the", "a", "one", "some", "any" };
//initialize noun array
const char *noun[10] =
{ "boy", "girl", "dog", "town", "car", "man", "woman", "cat", "mouse", "boat" };
//initialize verb array
const char *verb[5] =
{ "drove", "jumped", "ran", "walked", "skipped" };
//initialize preposition array
const char *preposition[5] =
{ "to", "from", "over", "under", "on" };
//to hold the sentence
char sentence[ SIZE ] = "";
// loop through and make 20 random sentences out of the given array
for ( int v = 0; v <= 20; ++v )
{
// uses function strcat to concatenate random sentences
strcat( sentence, article[ rand() % 5 ] );
strcat( sentence, " " );
strcat( sentence, noun[ rand() % 10 ] );
strcat( sentence, " " );
strcat( sentence, verb[ rand() % 5 ] );
strcat( sentence, " " );
strcat( sentence, preposition[ rand() % 5 ] );
strcat( sentence, " " );
strcat( sentence, article[ rand() % 5 ] );
strcat( sentence, " " );
strcat( sentence, noun[ rand() % 10 ] );
// print the current sentence
cout << static_cast< char > ( toupper( sentence[ 0 ] ) )
<< &sentence[ 1 ] << ".\n";
// reset the sentence
sentence[ 0 ] = '\0';
} // end for loop
cout << endl;
} // end displayStory function
tincup23
|
|
|
|
|
I am sorry, but I can't look at that huge amount of pure C string handling.
As this seem to be some C++-learning, you might as well try to use a string class (std::string or CString from MFC if you like).
Also, try to use the C++ std::vector class instead of static old C-arrays.
Sorry that I could not give you any algorithmical advice
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
I had a brain freeze with my original comment. I was thinking only of the word arrays. I still feel those should be left as is, though made global. However, you are right that he should use string or CString to build the resulting string. (Though, since he's going to output it immediately, I don't see why he just doesn't output the strings immediately.)
|
|
|
|
|
I never understand this type of advise. His program does not do a lot of string manipulation at all. The only string manipulation is the section where the strings are combined using strcat.
Not everything is better with std::string or CString. Old-style character arrays still work perfectly fine in a lot of cases.
|
|
|
|
|
Reinout Hillmann wrote:
I never understand this type of advise.[...]Not everything is better with std::string or CString. Old-style character arrays still work perfectly fine in a lot of cases.
But the original poster specifically stated that he wanted to learn C++. String classes (esp. std::string) are an integral part of working with C++ (as is using the STL and understanding templates).
You are right in stating that C-character arrays are fine, but they are definetly not C++, though seamlessly integrated.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
First, you should move the word arrays to be global. There's no need to repeat them.
Second, I don't see the point of using "sentence". Why not just output the words immediately? If you must store the sentence, use string .
Third, create a variable named "lastNoun" outside the loop. Assign it a random value (rand() %10 .) Use lastNoun as the index to both nouns. Just before the second usage, assign it a new random value.
You could add a small loop to ensure that you don't reuse the same noun.
(For consistancy, you should also retain the article using the same method.)
|
|
|
|
|
Hello,
I need to retrieve Date&Time from a remote UNIX server in the poche format to synchronize mi machine using a TCP/IP conection via sockets, how can I do that programming in VC++??
Edujule
|
|
|
|
|
If that server is listening on a particular port (some use 37, others 13), it can be done. Check out time_a.timefreq.bldrdoc.gov for more.
|
|
|
|
|
Hello,
The following code seems to work perfectly fine on Win 2k and above.. I think it may have some type of memory leak on 9x machines.. Can anyone find anything wrong with the following code?
It's used to paint my tree view..
void CMyTreeView::OnPaint()
{
if(IsWindowVisible())
{
CPaintDC dc(this);
CRect rcClip, rcClient;
dc.GetClipBox(&rcClip);
GetClientRect(&rcClient);
CDC memDC;
memDC.CreateCompatibleDC(&dc);
CBitmap bitmap;
bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
memDC.SelectObject(&bitmap);
CRgn rgn;
rgn.CreateRectRgnIndirect(&rcClip);
memDC.SelectClipRgn(&rgn);
rgn.DeleteObject();
CWnd::DefWindowProc(WM_PAINT, (WPARAM)memDC.m_hDC, 0);
if(m_bColor)
{
CRect border;
GetTreeCtrl().GetClientRect(&border);
memDC.FillSolidRect(0,0,1,border.bottom, RGB(255,0,0));
memDC.FillSolidRect(0,0,border.right,1, RGB(255,0,0));
memDC.FillSolidRect(border.right-2,0,2,border.bottom,RGB(200,0,0));
memDC.FillSolidRect(0,border.bottom-2,border.right,2,RGB(200,0,0));
}
HTREEITEM hItem = GetTreeCtrl().GetFirstVisibleItem();
while(hItem)
{
CRect rect;
UINT selflag = TVIS_DROPHILITED | TVIS_SELECTED;
Color_Font cf;
if (!(GetTreeCtrl().GetItemState(hItem, selflag) & selflag)
&& m_mapColorFont.Lookup(hItem, cf))
{
CFont *pFontDC;
CFont fontDC;
LOGFONT logfont;
CFont *pFont = GetFont();
pFont->GetLogFont(&logfont);
if(GetItemBold(hItem))
logfont.lfWeight = 700;
fontDC.CreateFontIndirect(&logfont);
pFontDC = memDC.SelectObject(&fontDC);
if(cf.color != (COLORREF)-1)
memDC.SetTextColor(cf.color);
CString sItem = GetTreeCtrl().GetItemText(hItem);
GetTreeCtrl().GetItemRect(hItem, &rect, TRUE);
memDC.SetBkColor(RGB(255,255,255));
memDC.TextOut(rect.left+2, rect.top+1, sItem);
memDC.SelectObject(pFontDC);
}
hItem = GetTreeCtrl().GetNextVisibleItem(hItem);
}
dc.BitBlt(rcClip.left, rcClip.top, rcClip.Width(), rcClip.Height(), &memDC,
rcClip.left, rcClip.top, SRCCOPY);
memDC.SelectObject(pOldBitmap);
pOldBitmap->DeleteObject();
memDC.DeleteDC();
}
}
BOOL CMyTreeView::OnEraseBkgnd(CDC* pDC)
{
pDC = NULL;
return TRUE;
}
Thanks,
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Looks good to me. You don't need to (and shouldn't) call pOldBitmap->DeleteObject() because the bitmap is still selected into the device context. Shouldn't cause any problems because you're deleting the device context without doing anything else to it, but you should remove that line
A couple of other points though...
What is the reason for setting pDC to NULL in OnEraseBkgnd() ? It's not necessary and will have absolutely no effect at all
Why are you using IsWindowVisible() ? OnPaint() won't get called unless the window is visible...
And you don't need to set the clip region in your memory device context. Your BitBlt() call is only copying the parts in the clip box anyway. Speed may seem like a reason to do it, but the process of checking everything against the clip region can be slower than simply writing everything to a memory device context, particularly for lower-end graphics cards.
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|