William Hemsworth 1,339 Posting Virtuoso

Hi all, I'm a very early user of Daniweb, and after a long break, and I'm hoping to participate a bit more in this forum again.

I'm here specifically for some advice before starting a new project of mine. I'm an experienced C++ / Win32 developer, but seem to be having trouble coming up with a good way of encoding AVI videos, or animated GIFs (or both!), in such a way that they will be quick to load and watch on my website. I don't really care about the final video output type, as long as I can upload them to my website and have them load up fairly quickly and render in high quality, cross-platform and on different browsers, whether it's using HTML5, GIF, or whatever. It doesn't have to be 100% lossless, but the higher the quality, the better.

I love making physics & biology simulations, and have already had some success building up a simulation framework in C++ capable of generating AVI videos, but the AVI encoding was unreliable, often problematic, and basically I want to have another go at doing this properly in a nice efficient and low-level way. I want to be able to create videos and/or animations which I can upload on to my website, and render detailed animations with as little loading time as possible - which I assume will require some basic level of compression.

Can anybody point me in the right direction, or reccommend any specific libraries? I like working quite …

William Hemsworth 1,339 Posting Virtuoso

I'm working on a program that requires some very low level optimization.

My question is, when precision isn't an important factor, how can I automatically use the most efficient floating point type for whatever architecture the program is being run on?

As far as I'm aware, floats are more efficient on 32 bit systems, and doubles are more efficient on 64 bit systems. Is there some sort of keyword or macro I can use which always uses the native data type for the machine it's being run on?

Thanks, appreciate any help.

William Hemsworth 1,339 Posting Virtuoso

Thanks for the tips! I appreciate it.

William Hemsworth 1,339 Posting Virtuoso

Hi, thanks for any help in advance.

I was hoping to get some guidance for getting started with connecting to an SQL database online. I'm writing an application in Win32 which needs to be able to read/write to a database. I have plenty of experience with C++, but almost no experience with networking. All I need to do is store a list of strings in a database online where they can be accessed and altered from any computer. I've tried getting started with MySQL but I'm not having much luck. I'm not even sure if SQL is the best option. I'm don't know how to create a database on a server, or how to securely connect to that server and read the database.

Could anyone provide any suggestions for how to get started? Thanks!

William Hemsworth 1,339 Posting Virtuoso

9f7ed0944cf37b1d91a39c1318f3f30b

For anybody who's interested in the math, here's a tutorial (made with the Flash IDE in mind):

William Hemsworth 1,339 Posting Virtuoso

Saw this and decided to make a little spinoff with some physics of mine. Enjoy!

William Hemsworth 1,339 Posting Virtuoso

hmm, think I figured it out

William Hemsworth 1,339 Posting Virtuoso

I would definetely say Flash AS2. The absolute most important part is that the students are motivated, and flash allows you to be very creative with just a basic knowledge of math. I got into programming through AS2 when I was about 12, and then started C++ a year later, which to my surprise had very similar syntax to flash actionscript. AS2 doesn't give annoying errors which will put off students, its flexible, and good practice. Since then, I've had a passion for programming because I see it as a form of art, not just a school subject.

Having now started at university, many people who have never programmed before are being forced to learn programming through dull Java console applications, it takes away the good enthusiasm I usually have when programming.

William Hemsworth 1,339 Posting Virtuoso

What is the virtual key code for "Alt" key. can anybody help?

VK_MENU

William Hemsworth 1,339 Posting Virtuoso

I used code blocks compilor and it's giving some errors

I used visual studio, it should work on code blocks but you may have to adjust the settings for it to work.

William Hemsworth 1,339 Posting Virtuoso

-

William Hemsworth 1,339 Posting Virtuoso

If you're using windows, try:

#include <windows.h>
#include <iostream>
using namespace std;

int main() {
  char szFileName[MAX_PATH];
  HINSTANCE hInstance = GetModuleHandle(NULL);
  GetModuleFileName(hInstance, szFileName, MAX_PATH);
  cout << szFileName;
  cin.ignore();
}
William Hemsworth 1,339 Posting Virtuoso

Well, a nice place to start is always here: http://www.winprog.org/tutorial/

However without the resource editor, you have a few different options, you could download a seperate resource editor, write your own resource file, or just avoid it entirely.

First thing's first, you need the code for setting up a small window, hopefully this should help refresh your memory on the topic a bit :)

#include <windows.h>

LRESULT CALLBACK WndProc(
      HWND hwnd,
      UINT msg,
      WPARAM wParam,
      LPARAM lParam)
{
  switch ( msg ) {
    case WM_CREATE:
      {
        // Make buttons here if you dont use any resources
      }
      break;
    case WM_COMMAND:
      {
        /* Button-pressed message is sent here

        switch ( LOWORD(wParam) ) {
        }

        */
      }
      break;
    case WM_CLOSE:
      {
        DestroyWindow( hwnd );
      }
      break;
    case WM_DESTROY:
      {
        PostQuitMessage( 0 );
      }
      break;
    default:
      return DefWindowProc( hwnd, msg, wParam, lParam );
  }

  return 0;
}

int WINAPI WinMain(
      HINSTANCE hInstance,
      HINSTANCE hPrevInstance,
      LPSTR lpCmdLine,
      int nShowCmd)
{
  WNDCLASSEX wc;
  HWND hwnd;
  MSG msg;

  wc.cbSize = sizeof(WNDCLASSEX);
  wc.cbClsExtra = 0;
  wc.cbWndExtra = 0;
  wc.hbrBackground = (HBRUSH)COLOR_WINDOW;
  wc.hCursor = LoadCursor(NULL, IDC_ARROW);
  wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
  wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
  wc.hInstance = hInstance;
  wc.lpfnWndProc = WndProc;
  wc.lpszClassName = "myclass";
  wc.lpszMenuName = NULL;
  wc.style = 0;

  if ( !RegisterClassEx(&wc) ) {
    return 1;
  }

  hwnd = CreateWindowEx(
          WS_EX_APPWINDOW,
          "myclass",
          "Window",
          WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
          CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, // x,y,width,height
          NULL, NULL, hInstance,
          NULL );

  if ( hwnd == NULL ) {
    return 1;
  }

  ShowWindow( hwnd, …
William Hemsworth 1,339 Posting Virtuoso

this must be the absolute geekiest thread in existence :P oh oh i mean: 0111010001101000011010010111001100100000011011010111010101110011
0111010000100000011000100110010100100000011101000110100001100101
0010000001100001011000100111001101101111011011000111010101110100
0110010100100000011001110110010101100101011010110110100101100101
0111001101110100001000000111010001101000011100100110010101100001
0110010000100000011010010110111000100000011001010111100001101001
0111001101110100011001010110111001100011011001010010000000111010
01010000

William Hemsworth 1,339 Posting Virtuoso

Thank you captain obvious =)

Well, the problem's so easily avoided I think it's barely worth trying to understand,
(also I admit I didn't read through the posts properly first :P)

William Hemsworth 1,339 Posting Virtuoso

Another more common method would be to just loop from the start to end, instead of from the end to the start.

for (unsigned short i = 0; i < n_elements; ++i) {
   array[i] = blah;
}
William Hemsworth 1,339 Posting Virtuoso

GetDlgItemInt retrieves the value from the edit box and returns it as an integer, so long as you're using Win32 API this should work fine.

William Hemsworth 1,339 Posting Virtuoso

I have a problem i wanted to rotate a picture and calculate the time taken using "C" programming language ..Its really very urgent .. Please help me out ..

Start a new thread, and show your current effort. It might be 'urgent' for you, but it's not for anybody else.

William Hemsworth 1,339 Posting Virtuoso

srand( static_cast<unsigned (time(NULL)) );// its also work fine
plz if u can help me a little and tell me how can i cout<<"asdfjkl"<<endl;//
if space key is press not enter thank you

huh.

William Hemsworth 1,339 Posting Virtuoso

... What are you doing here?

William Hemsworth 1,339 Posting Virtuoso

I stopped most of my activity here a fair while before the big change, but now I have even less reason to come back, I totally agree with Jephthah, it's ugly and unwelcoming. The fonts are a mess, the colors are plain and dull, and everything seems to put strain on the eye. Even the giant submit button puts me off :icon_rolleyes: I think Daniweb needs a major makeover, but this time a good one.

William Hemsworth 1,339 Posting Virtuoso

This is a C++ snippet I made a long time ago, it's practically C and with some searching I'm sure you would have found it anyway. It's well commented so it should help you. [link]

William Hemsworth 1,339 Posting Virtuoso

Really good program.
Can i inclue this in my AppSuite..
(I will mention your name... of course...)

Sure :P

William Hemsworth 1,339 Posting Virtuoso

When I compiled my first program.

Best moment of your life? Surely something more exhilarating's happened sometime in your life so far? :P

William Hemsworth 1,339 Posting Virtuoso

Post some code of what you have so far please.

William Hemsworth 1,339 Posting Virtuoso

I think it makes sense, when somebody says "Given an infraction", I interpret it as "Being given an infraction point" - a quantity of how much a user how violated the rules.

William Hemsworth 1,339 Posting Virtuoso

Post code so I see what you mean? When I have multiple window processes, I sometimes seperate them into different header files to stay organised.

William Hemsworth 1,339 Posting Virtuoso

I watched 'Remember Me' a couple of night ago, I really enjoyed it and the ending was just amazing, it's a big (sad) twist. Improved my opinion of Robert Pattinson alot.

William Hemsworth 1,339 Posting Virtuoso

And do you have a program for hooking keyboard? or the shell?

Look at my other snippets, indeed I do ;]

I dont mind any changes people make to the code if it makes it compatiable with a wider range of compilers.

William Hemsworth 1,339 Posting Virtuoso

That's because you've not set up your compiler properly, don't blame the code. Turn off UNICODE then try compiling again.

William Hemsworth 1,339 Posting Virtuoso

Runescape -> Crap

William Hemsworth 1,339 Posting Virtuoso

Hello, can u help me doing generation in sudoku? if it is possible may i know how to use the graphics u had in ur exe file? or how to generate random numbers in sudoku?

I would appriciate your help as I'm a new C++ learner but love stuff like this...

My graphics is purely Windows API, and took alot of work and practice in this case. Don't expect to be able to do something like this if you're just starting, if you dont know how to generate a random number by yourself, you're not ready.

There's lots of maths involved in this, I suggest you learn how the basics before anything else.

William Hemsworth 1,339 Posting Virtuoso

I don't think arithmetic exceptions are caught, if somewhere in the code you 'throw' and exception, then it will catch it.

#include <iostream>
#include <exception>
#include <string>

using namespace std;

int main () {
  int num1, num2;
  float resul;
 
  cout << "Introduce a number: ";
  cin >> num1;   //any number

  cout << "Introduce another number: ";
  cin >> num2;            //here I enter a zero

  try {
    if ( num2 == 0 ) {
      throw("Divide-by-zero exception thrown.");
    }

    resul = num1 / num2;

    cout << "Result is: " << resul << endl;
  }
  catch (char *err) {
    cout << err;
  }
}
William Hemsworth 1,339 Posting Virtuoso

First, try:

textBox9->Lines[0]="Succes";

If that doesn't work, post the rest of the code/function.

William Hemsworth 1,339 Posting Virtuoso

Can you please post your code?

William Hemsworth 1,339 Posting Virtuoso

Let Windows handle all that (:

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

int main() {
  char appDataPath[MAX_PATH] = { 0 };

  SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, appDataPath);
  std::cout << appDataPath;
}
William Hemsworth 1,339 Posting Virtuoso

Look life is much simpler without women, and i think i agree with friedrich nietche(if i type it correct) about women. I am four times as productive than in those days that i used to seek for happiness in women.

Might be true, but there's more to life than personal productivity. Once you are happy with a girl, it's not all that complicated and life can seem a little less dull :P

William Hemsworth 1,339 Posting Virtuoso

I've started mixing words together that i can easily remember for my passwords. Pretend my house alarm code is 7142, and my college username is WILLH, mix them together and:

7  1  4  3
 W  I  L  L  H
---------------
7W1I4L3LH

It looks pretty secure, and if you ever forget it, you can figure it out again in a minute or so.

William Hemsworth 1,339 Posting Virtuoso

Welcome back Serkan :icon_lol:

Sounds more If a hot girl hit on me, then I would be dating, but since I
do not have the courage to hit on hot girls

I got myself one :D But it's not exactly bad you found a hobby instead, it also means you're less preoccupied, and it's much easier to learn and get good at a hobby without distractions. But with exams and what-not recently I haven't had much time for anything anyway :icon_eek:

William Hemsworth 1,339 Posting Virtuoso

Has anybody seen that 2012 movie?

Yep, it's pretty good, quite long though.

William Hemsworth 1,339 Posting Virtuoso

Well these errors don't seem as bad, but I'm not much help until I see the improved code again, those just look like small syntax errors, but I can't tell for sure.

William Hemsworth 1,339 Posting Virtuoso

I think the main problem is you haven't really learned the basics of C++, such as scopes, functions, and layout. Before trying something on this level, maybe read a few more tutorials. More specifically.. the structure of a program, Scopes and Functions.

The main problem in the code you provided is that you have a function inside your main function. The CreateShortcut function should be totally seperate from the rest of the code.

William Hemsworth 1,339 Posting Virtuoso

Depends on how big the program is. Post enough code to recreate the exact same errors you're getting if possible.

William Hemsworth 1,339 Posting Virtuoso

They seem like pretty straightforward errors, if you post the exact code you're using I can hopefully highlight your mistakes.

William Hemsworth 1,339 Posting Virtuoso

Yea, i already seen that, but when i compile, i get allt hese wierd errors, that i have never seen before :S

Post your errors, maybe we can help. :icon_wink:

William Hemsworth 1,339 Posting Virtuoso

Find out how to create shortcuts. Off 5 second of googling [link]

William Hemsworth 1,339 Posting Virtuoso

What's wrong with you ppl? The man said that all have been working fine until one day. Why every time someone asks why there is no sound in WMP the given answers are always "reinstall/update drivers" or "install codecs"?

You clearly didn't understand his problem. He got a new laptop (which by default wont always have all the codecs installed), so that's nearly always the problem.

Also, the OP posted this question over 6 months ago, so what's wrong with you? Check thread dates before posting in them, I'm sure he's resolved it now.

William Hemsworth 1,339 Posting Virtuoso

My guess would be a .NET CLI Application.

William Hemsworth 1,339 Posting Virtuoso

I'm surprised the guy even had the ability to sign up.

tux4life commented: Yeah, they can't use Google, except for finding forums :P +6
William Hemsworth 1,339 Posting Virtuoso

What's happening to the standards of posts these days? :icon_rolleyes:
Learn how to present a question, and try again.