Forum: C++ 9 Days Ago |
| Replies: 23 Views: 917 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 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: 917 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: 917 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: 917 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: 184 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 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 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 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 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 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 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 Not sure, but does this work?Datetime^ curDate = gcnew Datetime();
curDate = DateTime::Now; |
Forum: C++ 20 Days Ago |
| Replies: 5 Views: 230 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 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 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 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: 335 Good (: You can flag the thread as solved at the bottom. |
Forum: C++ 23 Days Ago |
| Replies: 9 Views: 335 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: 335 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: 335 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 Views: 318 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 Views: 531 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 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 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 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 Have you tried SetFocus (http://msdn.microsoft.com/en-us/library/ms646312(VS.85).aspx)? |
Forum: DaniWeb Community Feedback Oct 17th, 2009 |
| Replies: 9 Views: 1,097 Mine's been changed twice ;) even if it was only by a letter or two each time. |
Forum: C++ Oct 17th, 2009 |
| Replies: 12 Views: 740 Glad to see you got it working :icon_lol:
You're welcome. |
Forum: C++ Oct 17th, 2009 |
| Replies: 12 Views: 740 Don't know, if you did everything I said it should have worked. |
Forum: C++ Oct 17th, 2009 |
| Replies: 12 Views: 740 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 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 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: DaniWeb Community Feedback Oct 17th, 2009 |
| Replies: 9 Views: 1,097 If it didn't allow you, that's because its probably already been taken. Try the same name slightly changed, for example, you would probably find Assim2 works, but be creative. |
Forum: C++ Oct 17th, 2009 |
| Replies: 2 Views: 187 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 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 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 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 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 You clearly didn't search hard.str.c_str() // returns a constant pointer to its characters |