William Hemsworth 1,339 Posting Virtuoso

Not really my "favorite", but Wanted is a very very good action movie. If you liked Die Hard you will also like Wanted.

I liked Wanted, even though it went a little extreme in some parts.
Uhm.. The hangover, The Shawshank Redemption, The Matrix, The Lake House, there's just too many to pick from.

William Hemsworth 1,339 Posting Virtuoso

Is there any language or way to write a program that is about 10000 lines in such a way that it can't be re-engineered by decompiling it ? What options are available to pursue ?

Thank you for your time..

C++ isn't really decompilable, it's possible to turn the machine code back to C-Instructions with meaningless variable names, but nobody will get anywhere with a 10000 line program.

William Hemsworth 1,339 Posting Virtuoso

Has anybody seen the video linked to in the first post?

Yep, that's obviously how it happened :icon_razz:

William Hemsworth 1,339 Posting Virtuoso

I think the number of active users has always been fairly low, for example at the moment the only people I see regularly in the list are:


Most of the rest will ask their question, and never come back. Some may return a few more times, but very few actually stay.

And yep, call of duty's been released :icon_cheesygrin:

William Hemsworth 1,339 Posting Virtuoso

I don't know anyone and haven't seen any posts where people make their own namespace.

Now you know another, my entire personal library is wrapped in a number of namespaces, without them it would be chaos.

William Hemsworth 1,339 Posting Virtuoso

I made a little snippet that allows you to directly access the pixels and save it as a .bmp. [link] I've simplified it a little for you.

#include <windows.h>
#include <iostream>
#include <cmath>

typedef unsigned long ulong;
typedef unsigned short ushort;
typedef unsigned char ubyte;

struct Pixel {
   union {
      ulong rgb;
      struct {
         // r, g, b share same memory as rgb
         unsigned char b, g, r;
      };
   };

   Pixel() {
      // Automatically set pixel black
      rgb = 0;
   }

   // Init pixel
   Pixel(byte _r, byte _g, byte _b) {
      r = _r;
      g = _g;
      b = _b;
   }

   operator ulong() {
      return rgb;
   }

   void operator ()(byte _r, byte _g, byte _b) {
      r = _r;
      g = _g;
      b = _b;
   }

   // Set pixel
   Pixel &operator =(ulong _RGB) {
      rgb = _RGB;
      return *this;
   }
};

template<short _Width, short _Height>
struct Bitmap {
   // Pixels
   Pixel *pixels;

   // Dimensions
   short width;
   short height;

   // Init
   Bitmap() {
      width = _Width;
      height = _Height;

      // Allocate Pixels
      pixels = new Pixel[width * height];
   }

   // Destroy
   ~Bitmap() {
      // Free all pixels
      delete[] pixels;
   }

   inline Pixel &operator()(short x, short y) {
      // Returns reference to pixel
      return pixels[(height - ++y) * width + x];
   }

   void save(const char *_FileName) {
      // Function to save as bitmap (no compression)
      BITMAPINFOHEADER bmpInfoHeader = {0};

      // Properties
      bmpInfoHeader.biSize = sizeof(BITMAPINFOHEADER);
      bmpInfoHeader.biBitCount = sizeof(Pixel) * 8;
      bmpInfoHeader.biClrImportant = 0;
      bmpInfoHeader.biClrUsed = 0;
      bmpInfoHeader.biCompression = BI_RGB;
      bmpInfoHeader.biHeight …
Nick Evan commented: Sweet! Bookmarked. +10
William Hemsworth 1,339 Posting Virtuoso

Well, I just clicked the link in your sig, and the same happened for me.

+++ mib_40s77j set to mode +iwx
You are banned from the channel #Daniweb

William Hemsworth 1,339 Posting Virtuoso

This is the implementation, firstly you can't do this in one line, and even if you could nobody would care.

William Hemsworth 1,339 Posting Virtuoso

really nice snippet (: I'm sure this will come in handy for me sometime.

William Hemsworth 1,339 Posting Virtuoso

Yeah. If i remember rightly, didnt we used to have one for flash before, and it never got used hardly?

I still think it should be revived :icon_lol: I would also have plenty of tutorials to write for flash.

On that note, I noticed that when creating a new thread, there is a "Tutorial" option where it says "What are you posting?" Haven't tried yet, but does submitting a tutorial work?

William Hemsworth 1,339 Posting Virtuoso

You know you are a geek when you can say your name in binary without having to think twice. 01110111011010010110110001101100011010010110000101101101 :P

William Hemsworth 1,339 Posting Virtuoso

But I really wanna know how to delete the last line!

Then make a new file, copy only the content you need from the first one, delete the first file, and rename the second file.

William Hemsworth 1,339 Posting Virtuoso

Nice, neat, consistent format, and well commented code :]

William Hemsworth 1,339 Posting Virtuoso

Oh I know what I should do I just can't get it to work. What do you mean by the temporary surface - a HBITMAP object ?

Yes, but to draw to it you need its HDC. This kind of drawing with the Windows API is hell, I'd say if it's possible, use a graphics library, if not you might be spending a while trying to get it to work.

I gave up graphics with the Windows API long ago :P

William Hemsworth 1,339 Posting Virtuoso

You will have to create a temporary surface to draw on for that one line, and when you release the mouse, it copies that surface to the main one.

William Hemsworth 1,339 Posting Virtuoso

Doesn't anyone else think that was a truly amazing way to open a bottle of wine.

It was rather amusing, but when I'm old enough to even drink, i'll stick to a corkscrew :P

William Hemsworth 1,339 Posting Virtuoso

We wont give you a free solution to what's probably homework, have you even tried it yet?

William Hemsworth 1,339 Posting Virtuoso

Nope, not as far as I know, you will just have to create a function to return the right values, this could be a start:

string getValueName(char vk) {
  string name;

  if ( vk >= '0' && vk <= '9' ) {
    name.push_back( vk );
    return name;
  }

  switch ( vk ) {
    case VK_SPACE:  return "Space";
    case VK_SHIFT:  return "Shift";
    // ... more cases
  }

  return "";
}
William Hemsworth 1,339 Posting Virtuoso

In version 8, you can just do it from the dialog interface, scroll down to the 'Menu' option, and select the name of the menu you created (view screenshot)

If you can't do that, you could edit the resource file directly, for example:

IDD_MAIN DIALOGEX 0, 0, 186, 94
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
[B]MENU IDR_MENUNAME[/B]
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
    DEFPUSHBUTTON   "OK",IDOK,129,7,50,14
    PUSHBUTTON      "Cancel",IDCANCEL,129,24,50,14
END

And, if all else fails, you can do it programically:

int CALLBACK WndProc(
      HWND hwnd,
      UINT msg,
      WPARAM wParam,
      LPARAM lParam)
{
  switch ( msg ) {
    case WM_INITDIALOG:
      {
        [B]HINSTANCE hInstance = GetModuleHandle( NULL );
        SetMenu( hwnd, LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU1)) );[/B]
      }
      break;
    case WM_CLOSE:
      {
        EndDialog( hwnd, 0 );
      }
      break;
  }
  return 0;
}

Hope this helps.

William Hemsworth 1,339 Posting Virtuoso

Yeah, im still using avast and it seems to keep the boot time fine. I used AVG and it seemed to slow down a LOT

Really? AVG is by far the fastest least-noticeable anti-virus program I've used. My pc loads up with AVG, Winamp and msn messenger in under a minute ready to go, and it isn't the most powerful computer in the world.

William Hemsworth 1,339 Posting Virtuoso

First of all, I don't think that; "Void Main()" is ISO standard, I think you should stick to "Int Main()".

Secondly you're redeclaring numbers in Main, after making it a global variable.

Thirdly you're calling; "push(value);", which isn't really calling your own function, it's calling "push(const value_type& __x)" inside the "stl_queue.h" libary, atleast that's what my compiler does.

He didn't write the code, nor does he understand it, so he's asking for someone to baby him through each line.

William Hemsworth 1,339 Posting Virtuoso

No, nobody is going to explain that badly formatted C code to you which should have been wrapped in code-tags. You clearly didn't write it, so what I suggest you do is learn how to program, buy a book, whatever works.

William Hemsworth 1,339 Posting Virtuoso

Pretty funny site :) Every time you reach the end of the page, it's hard to not click next, who know's what absurd thing could be on the next page? :P

William Hemsworth 1,339 Posting Virtuoso

Yeah, pretty much. Calzones too. :)
Just as long as there is anything left when we close.

Awesome :icon_cool:

This is by far the most relaxed thread on Daniweb.

William Hemsworth 1,339 Posting Virtuoso

I eat more than my fair share of pizza because I work in a pizzeria.
It really is the best food.

I envy you, so what, you just get free pizza? :icon_razz:

William Hemsworth 1,339 Posting Virtuoso

Yep, I think it's a pretty essential thing to have. For example, alot of the time when I browse the C/C++ forums, I find a thread I feel I can answer, but then I see someone such as Ancient Dragon is already at it, it saves me having to make a useless second post.

It's also just generally nice to see who's online :)

William Hemsworth 1,339 Posting Virtuoso

Pizza

Mmmm. Pizza.

William Hemsworth 1,339 Posting Virtuoso

Well, C++ can compile almost any C code, except for a few minors differences. Post the code and I'll see.

William Hemsworth 1,339 Posting Virtuoso

Is it just me, or has the 'Whos online' block disappeared from the end of the page as well?

You're right :icon_neutral: It's gone.

Dani, what's going on? :P

William Hemsworth 1,339 Posting Virtuoso

look at the brighter side... it tells you that ur bf is serious types and not just wham-bam-thankyou-mam types..... he's patient (he has to be!) and that should satisfy you for now

How can you tell? From her original post it seems he's already getting "it" :icon_wink:

he wants to do "it" and i do too

wen u do have sex and tell them that youve done it

I agree with the rest of them, and her parents :P

William Hemsworth 1,339 Posting Virtuoso

Your condition for that loop is:

(s[i] != '\0') || (s[i] != ' ')

Now think, is there any way that expression will ever be false in order to break out the loop? If s is a null-terminator, the loop wont break as s isn't a space, and the same the other way round.

The condition would make sense if instead of having ||, you used &&, but I don't know your intentions.

William Hemsworth 1,339 Posting Virtuoso

Pretty much, if you want to use the Win32 API, the code will look very similar to C, but that's why they made MFC.

William Hemsworth 1,339 Posting Virtuoso

Again: I'm reiterating because I feel very strongly about this.

The 'new' buttons are distracting and unnecessary. They don't add any features to the site - let me explain. If I have already been in a thread, I know approximately where I left off, and there is already an indicator that there are new posts there (the link is dark blue or something) so I know to go back. If I haven't been in a thread before, then I already know I haven't been in there, the link is still blue, and the 'new' button does nothing except tell me what I already know: that I haven't read any posts in there.

So you see - in either case - I don't see what that button contributes except an eyesore. I'm not trying to be rude because I think this site rocks, and I think almost every feature is pretty good layout-wise. . but this one. . ugh.

I agree, but for now you will just have to use AdBlock or something if it annoys you that badly :icon_lol:

William Hemsworth 1,339 Posting Virtuoso

I feel left out :icon_sad: No money to spare.

William Hemsworth 1,339 Posting Virtuoso

plz plz urgent im a beginner in unix.
can someone reply asap .
what are kernel modules?what role do they plan in building and runnig a kernel?what happens if the linux kernel did not support modules?

Don't beg, you are supposed to ask specific questions here, otherwise use google.

William Hemsworth 1,339 Posting Virtuoso

I had never even heard of a negative base until you said that, I looked it up and it seems interesting. But, this function already uses a sign to represent negative numbers, maybe I could make a different one to handle negative bases.

Thanks for the feedback :)

William Hemsworth 1,339 Posting Virtuoso

Here's a function that manually converts an integer to any base between 2 and 36, the parameter list is:

void toBase(
   int value,		// Integer value to convert
   char *target,	// Pointer to a large enough buffer
   int base,		// Base (from 2 to 36)
   int fixedDigitCount	// The minimum number of digits it must contain
);

This gives me the following output:

Binary with no fixed number of digits (1 to 15):
1 10 11 100 101 110 111 1000 1001 1010 1011 1100 1101 1110 1111

Binary with 4 fixed digits (1 to 15):
0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111


Octal with no fixed number of digits (1 to 15):
1 2 3 4 5 6 7 10 11 12 13 14 15 16 17

Octal with 3 fixed digits (1 to 15):
001 002 003 004 005 006 007 010 011 012 013 014 015 016 017


Decimal with no fixed number of digits (1 to 15):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Decimal with 4 fixed digits (1 to 15):
0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011 0012 0013 0014 0015


Hex with no fixed number of digits (1 to 15):
1 2 3 4 5 6 7 8 9 A B C D E F

Hex with 2 fixed digits (1 to 15):
01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F

William Hemsworth 1,339 Posting Virtuoso

Uhm you want a compilable project or just the code? Because my project has a few dependencis.
MySQL is a killer: 500 MB :P

I'll stick with just the code please ;)

William Hemsworth 1,339 Posting Virtuoso

The only way I can think of, is to use some inline assembly and get the value of the PC register, look up the use of asm with C.

William Hemsworth 1,339 Posting Virtuoso

Well I have used many hours, and unlike normally, I'm completely clueless.
I'd be very glad if you could help me, and I could send over my project if thats what it takes. Its a bit too long to be posted here.

It's worth a shot, just copy the project, delete unneeded compiler generated files, zip it and attach here :)

William Hemsworth 1,339 Posting Virtuoso

Now I want to be able to, from the dialog, send messages, but I cant figure out how to sepparate the dialogs and get the contact.hWnd (to hide window) and the contact.id to send a message back.

Obviously the use of arrays here has made this very confusing, maybe it's possibly to do without, I don't know. But all I can suggest is to try using global variables and message notifications too, at this stage in making the program you have the biggest understanding of the problem and your intentions, so it's easiest for you to solve (unless perhaps I take a look at the entire project).

William Hemsworth 1,339 Posting Virtuoso

Does Windows 7 still require those sluggishly slow virus programs, registry cleaners, spyware detectors/cleaners etc. etc. ???

It depends which 'sluggisly slow' virus programs you use, I use AVG on Vista and it's totally invisible to me, never had any problems. Norton however feels like it halves the speed of my computer.

William Hemsworth 1,339 Posting Virtuoso

So let me get this right, you basically have an array of hWnd's which all link to the same event handler, but you want to do different things with each of them in the messengerBox dialog when it's opened.

Even if I understood correctly, it depends what kind of changes will be in each new messengerBox dialog, will it have a totally new layout? or different data in the text fields?

More code, screenshots, anything to describe it better would be helpful.

William Hemsworth 1,339 Posting Virtuoso

Hope you understand!

Can't say I do, hWnd will hold the handle to the window being used, so can't you just write:

ShowWindow(hWnd, SW_HIDE);

If not, you will have to clarify :P

Posting / Attaching the whole code would help.

William Hemsworth 1,339 Posting Virtuoso

Really cool actually, nice find :)

William Hemsworth 1,339 Posting Virtuoso

Code

What's this? You just supplied an entire program when all he wanted was help on one case.

William Hemsworth 1,339 Posting Virtuoso

Also R, well that sucked :P there needs to me more options and outputs.

William Hemsworth 1,339 Posting Virtuoso

Much better :) The bug I pointed out quite some time ago in this thread was never fixed either.

William Hemsworth 1,339 Posting Virtuoso

I can't say I like the dotted underlining and popup either :icon_neutral:
It's all very distracting.

William Hemsworth 1,339 Posting Virtuoso

Please, dont talk about downloading warez here

To be fair, the game is 16 years old and probably freely available on the net, I know the demo is. [link]