Search Results

Showing results 1 to 40 of 194
Search took 0.04 seconds.
Search: Posts Made By: William Hemsworth ; Forum: C++ and child forums
Forum: C++ 9 Days Ago
Replies: 23
Views: 918
Posted By William Hemsworth
You could just use the free Microsoft Visual C++ Compiler / IDE, it comes with everything together. [link] (http://www.microsoft.com/Express/VC/#webInstall)
Forum: C++ 10 Days Ago
Replies: 2
Solved: re
Views: 169
Posted By William Hemsworth
Sure, but I get the feeling you didn't search first. Try this:#include <iostream>
#include <direct.h>
using namespace std;

int main() {
_mkdir("C:\\My Directory");
}
Forum: C++ 11 Days Ago
Replies: 23
Views: 918
Posted By William Hemsworth
Just because it doesn't work, doesn't mean the compiler has a bug. I changed it, and it worked. I just used the resource code from another project which had a auto-generated resource file.

There's...
Forum: C++ 11 Days Ago
Replies: 23
Views: 918
Posted By William Hemsworth
I'm pretty confident that's not how it works, the preprocessor just replaces #include "resource.h" with the content of the file anyway. I think it's something to do with your resource file code, it...
Forum: C++ 12 Days Ago
Replies: 23
Views: 918
Posted By William Hemsworth
When you get into problems with resources like this, just start over, it saves yourself trouble in the long run. Also, use a resource Viewer/Editor if possible, it prevents these sort of problems.
Forum: C++ 14 Days Ago
Replies: 4
Views: 186
Posted By William Hemsworth
I'm afraid the code is correct :)
The problem is a compiler setting, make sure the project is a "Windows Application".

And if you seriously can't figure out the compiler option (and you're using...
Forum: C++ 14 Days Ago
Replies: 6
Views: 216
Posted By William Hemsworth
The easy way, at the very start of your code, add this line:#pragma comment(lib, "comctl32.lib")
Forum: C++ 15 Days Ago
Replies: 6
Views: 216
Posted By William Hemsworth
Yep, nezachem is correct, the prototypes in that header mean nothing if they aren't linked with the right library. Try linking to comctl32.lib.
Forum: C++ 15 Days Ago
Replies: 8
Views: 279
Posted By William Hemsworth
The file doesn't need to appear in the solution explorer. Do you know how to work with resource files? You can put any kind of file into a resource file, you just need the right commands to read...
Forum: C++ 15 Days Ago
Replies: 8
Views: 279
Posted By William Hemsworth
See example code and attachments.#include <windows.h>
#include "resource.h"
#pragma comment(lib,"Winmm.lib")

int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
...
Forum: C++ 15 Days Ago
Replies: 8
Views: 279
Posted By William Hemsworth
Well, to use that line of code, the .wav file has to be in the same directory as the executable/project folder if you're running directly from Visual Studio. If you want to attach it to your resouce...
Forum: C++ 15 Days Ago
Replies: 8
Views: 279
Posted By William Hemsworth
You forgot the SND_FILENAME argument, change that line to:PlaySound((LPCWSTR)"tone.wav", 0, SND_LOOP|SND_ASYNC|SND_FILENAME);and it should work.
Forum: C++ 20 Days Ago
Replies: 2
Views: 229
Posted By William Hemsworth
Not sure, but does this work?Datetime^ curDate = gcnew Datetime();
curDate = DateTime::Now;
Forum: C++ 20 Days Ago
Replies: 5
Views: 230
Posted By William Hemsworth
Yep, almost all spaces (except those between keywords) are ignorable, so in the end the compiler would just see it as int*a anyway.
Forum: C++ 21 Days Ago
Replies: 5
Views: 237
Posted By William Hemsworth
So you want to swap keys around, for example the user presses 'INSERT', 'A' is pressed instead? You don't need to use SendInput, it's much simpler to use keybd_event, so you can change that case...
Forum: C++ 22 Days Ago
Replies: 5
Views: 237
Posted By William Hemsworth
Misread the question, but that's still a great way to detect keypresses, the rest shouldn't be hard.
Forum: C++ 22 Days Ago
Replies: 5
Views: 237
Posted By William Hemsworth
Really not the best way to detect keystrokes, I'd suggest a Windows hook, because you can actually change what the output of that key will be. For example, here's how you could turn the Space bar...
Forum: C++ 23 Days Ago
Replies: 9
Views: 336
Posted By William Hemsworth
Good (: You can flag the thread as solved at the bottom.
Forum: C++ 23 Days Ago
Replies: 9
Views: 336
Posted By William Hemsworth
I edited my post maybe before you tried that code, try again. There's no reason why that function shouldn't work, if it still doesn't work, show me the code you're using.
Forum: C++ 23 Days Ago
Replies: 9
Views: 336
Posted By William Hemsworth
Either turn UNICODE off, or change the code to:#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <iostream>
#include <fstream>

void saveCaption(HWND hwnd, TCHAR *filename) {
int...
Forum: C++ 23 Days Ago
Replies: 9
Views: 336
Posted By William Hemsworth
Wouldn't usually give away code, but it's just so small.#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <iostream>
#include <fstream>

void saveCaption(HWND hwnd, char *filename) {
...
Forum: C++ 26 Days Ago
Replies: 7
Solved: memory leak
Views: 318
Posted By William Hemsworth
Check variables that you allocated memory on, and make sure you deleted it somewhere else in the code. If you forget to free any memory, that's a memory leak.
Forum: C++ Oct 28th, 2009
Replies: 9
Solved: Adding Sounds
Views: 531
Posted By William Hemsworth
Perhaps the PlaySound (http://msdn.microsoft.com/en-us/library/aa909766.aspx) function?
PlaySound("H:\\sissys.mp3", NULL, SND_FILENAME);
Forum: C++ Oct 22nd, 2009
Replies: 12
Views: 368
Posted By William Hemsworth
If it's the default tab-control, then your event handler should look somewhat like this:case WM_NOTIFY:
{
HWND tabs = GetDlgItem(hDlg, IDC_TABS);
switch (...
Forum: C++ Oct 21st, 2009
Replies: 12
Views: 368
Posted By William Hemsworth
Show me your code.

Have you already programmed the functionality of the tabs? and do you have a HWND of the text box? If not, these are small details I can still help with.
Forum: C++ Oct 21st, 2009
Replies: 12
Views: 368
Posted By William Hemsworth
If you use SetFocus on the handle to the text box, it should move the text cursor to there.
Just tried it, it worked.
Forum: C++ Oct 21st, 2009
Replies: 12
Views: 368
Posted By William Hemsworth
Have you tried SetFocus (http://msdn.microsoft.com/en-us/library/ms646312(VS.85).aspx)?
Forum: C++ Oct 17th, 2009
Replies: 12
Views: 740
Posted By William Hemsworth
Glad to see you got it working :icon_lol:
You're welcome.
Forum: C++ Oct 17th, 2009
Replies: 12
Views: 740
Posted By William Hemsworth
Don't know, if you did everything I said it should have worked.
Forum: C++ Oct 17th, 2009
Replies: 12
Views: 740
Posted By William Hemsworth
You're missing two sets of end curly braces, change the end to this:private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
form2 ^secondForm = gcnew...
Forum: C++ Oct 17th, 2009
Replies: 12
Views: 740
Posted By William Hemsworth
When you double click your button in designer mode, it takes you to the code that's executed once it's pressed, It would look something like this:private: System::Void mybutton_Click(System::Object^ ...
Forum: C++ Oct 17th, 2009
Replies: 12
Views: 740
Posted By William Hemsworth
Looks good to me.

Okay, now at the top up your header file Form1.h, add the code:#include "Form2.h"and to hide the current form and open the new one, place this code in the event handler of the...
Forum: C++ Oct 17th, 2009
Replies: 2
Views: 187
Posted By William Hemsworth
Remember, you're using managed C++, so you need to use managed types.String^ ba = "41516.7095211088";
Double bb = Convert::ToDouble( ba );
Int32 rounded = (Int32)Math::Round( bb );...
Forum: C++ Oct 17th, 2009
Replies: 12
Views: 740
Posted By William Hemsworth
Yes, merge them, all you have to do as far as i know is rename the second form to "Form2" and copy it to the first project. Once you've done that, linking them together isn't too hard.

Try that...
Forum: C++ Oct 14th, 2009
Replies: 5
Views: 288
Posted By William Hemsworth
If it's an std::string, do mystr.c_str() to get a character array, to access an individual character, do mystr[charIndex]. This is all over the web, try searching first.
Forum: C++ Oct 6th, 2009
Replies: 1
Views: 330
Posted By William Hemsworth
One windows header file usually includes 10/15 others, you can never be sure if it's included until you check. Besides, there's no harm in putting #include<iostream> again, that's what header guards...
Forum: C++ Oct 4th, 2009
Replies: 4
Views: 259
Posted By William Hemsworth
If you want to 'copy' the string into a character buffer, you have to do something along the lines of:char *newStr = new char[str.length()+1];
strcpy( newStr, str.c_str() );

// Deal with newStr
...
Forum: C++ Oct 4th, 2009
Replies: 4
Views: 259
Posted By William Hemsworth
You clearly didn't search hard.str.c_str() // returns a constant pointer to its characters
Forum: C++ Oct 3rd, 2009
Replies: 7
Views: 428
Posted By William Hemsworth
If you're curious, test it on your own computer :P
I just did, and it did exactly what I said it would.
Forum: C++ Oct 3rd, 2009
Replies: 7
Views: 428
Posted By William Hemsworth
Damage? I doubt it. The physical memory would quickly run out, and then your pc would automatically free all the memory you allocated when you restart the pc or somehow close it.
Showing results 1 to 40 of 194

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC