On October 30 2011 04:28 delHospital wrote:
use sscanf from stdio.h
this won't even compile
use sscanf from stdio.h
this won't even compile
I fixed quotations, it was typo and yes it compiles.
Forum Index > General Forum |
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. | ||
SRBNikola
Serbia191 Posts
On October 30 2011 04:28 delHospital wrote: Show nested quote + On October 30 2011 04:16 Isualin wrote: hello im new in c++. i was using Convert.ToDouble(blabla) in c# but i dont know how to do this in c++. so how can i convert char '3' to double 3. i need to get values from a char array like "6-8*2+45". use sscanf from stdio.h Show nested quote + On October 30 2011 04:22 LionKiNG wrote: EDIT: Sorry, this should work better: char ch = "A"; this won't even compile I fixed quotations, it was typo and yes it compiles. | ||
Isualin
Turkey1903 Posts
| ||
Craton
United States17233 Posts
This URL will autoplay, but the player size is fixed (and small) and I don't know how (or if you can) full screen the flash player from the program. System.Diagnostics.Process.Start("http://www.own3d.tv/liveembed/81266?autoPlay=true"); This URL will fit the screen (so it's as big as the browser), but won't autoplay. System.Diagnostics.Process.Start("http://www.own3d.tv/livepopout/clgame_38728"); I'm also unsure how to maximize the browser after opening it, while still making sure it's at the front of whatever else is open. | ||
Necosarius
Sweden4042 Posts
On October 26 2011 01:01 LunaSaint wrote: Necosarius: Tuples can't be changed when they're made, so the method you currently use would not work with them. Also, you said that you were meant to make a list of tuples. A list of tuples would look like this: [(0,0), (0,1), (0,2)] This basically makes a table that has as many columns as there are tuples, and as many rows as there are values within the tuples. In other words, you're making a structure like this: 0|0|0 If that doesn't help, the spoiler details how it would look for a dictionary. + Show Spoiler [What a dictionary would look like as a…] + [("Apple", "A red or green fruit found on trees."), ("Banana", "A yellow, curved fruit found on trees in warmer climates."), ('Name', 'Description')] This way, you have a list of tuples containing a word and its definition.
You said you just wanted a hint, so I won't explain how you'd integrate it into a dictionary, but I hope that makes sense. -- Halp!: I'm going to be using Python with Pygame to make a basic Turn Based Strategy using a square grid system, but there's still a lot of image based functions of Pygame I don't grasp. I'm trying to work out how to import a segment of an image only - in this case, a tile from a tileset. Thank you, I was able to figure it out ^^ | ||
Deleted User 101379
4849 Posts
On October 30 2011 21:50 Craton wrote: I'm working on a way to programmatically open a user's default browser, maximize it, and press play on an embedded flash stream, specifically for Own3D. I'm using C# / Windows Forms. This URL will autoplay, but the player size is fixed (and small) and I don't know how (or if you can) full screen the flash player from the program. System.Diagnostics.Process.Start("http://www.own3d.tv/liveembed/81266?autoPlay=true"); This URL will fit the screen (so it's as big as the browser), but won't autoplay. System.Diagnostics.Process.Start("http://www.own3d.tv/livepopout/clgame_38728"); I'm also unsure how to maximize the browser after opening it, while still making sure it's at the front of whatever else is open. While this isn't impossible, it's very close to that since you can't control a Firefox, Chrome or Opera browser directly. However, you can use a WebBrowser Control in your application to embed the Internet Explorer and open the page with it. AFAIK it is also possible to execute your own Javascript to "press play" on the stream. Then just have the WebBrowser instance open in a new, maximized frame with "Always on Top" enabled and it should work as you want it to. Haven't used the WebBrowser Control myself, so can't give you any specifics, but i have seen similar things done with it. | ||
Craton
United States17233 Posts
My googling seems to imply that such a thing is impossible. The ActionScript that initiates full-screen mode can be called only in response to a mouse event or keyboard event. If it is called in other situations, Flash Player throws an exception. http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7c5d.html How can I open a web browser through C# that has the bars at the top hidden and scroll bars disabled? I know you can normally do it through an html button with javascript tied to it, but I can't figure out how to do that in C#. --- Running the code below throws an error: ex = {"ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment."} frmBrowser is a form containing a WebBrowser control and nothing else. The earlier part of the code basically sets an alarm and when it goes off calls the second function. I set it to just wait 2 seconds for development purposes.
Program.cs
File: http://www.mediafire.com/?ef958apbjgn369b I condensed everything from the original project to this secondary project to try and weed out the problem, but I can't figure out how to solve it. | ||
Orome
Switzerland11984 Posts
| ||
Deleted User 101379
4849 Posts
On October 30 2011 22:43 Craton wrote: You'd have to give me an example on how to javascript rig it to start / full screen. My googling seems to imply that such a thing is impossible. Show nested quote + The ActionScript that initiates full-screen mode can be called only in response to a mouse event or keyboard event. If it is called in other situations, Flash Player throws an exception. http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7c5d.html How can I open a web browser through C# that has the bars at the top hidden and scroll bars disabled? I know you can normally do it through an html button with javascript tied to it, but I can't figure out how to do that in C#. --- Running the code below throws an error: ex = {"ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment."} frmBrowser is a form containing a WebBrowser control and nothing else. The earlier part of the code basically sets an alarm and when it goes off calls the second function. I set it to just wait 2 seconds for development purposes. + Show Spoiler +
Program.cs
File: http://www.mediafire.com/?ef958apbjgn369b I condensed everything from the original project to this secondary project to try and weed out the problem, but I can't figure out how to solve it. You are creating the frmBrowser from a different Thread. This is not allowed by .NET. You have to use Invoke to change the thread context to the GUI thread. Pass a reference to the Form1 to OpenBrowser and then call yourForm1Variable.Invoke(OpenStream, new object[]{id}). See: http://msdn.microsoft.com/en-US/library/a1hetckb.aspx As for executing Javascript in the WebBrowser Control a quick google showed this two links. For more details, you might have to google yourself: http://notions.okuda.ca/2009/06/11/calling-javascript-in-a-webbrowser-control-from-c/ http://stackoverflow.com/questions/1437251/calling-a-javascript-function-in-the-c-sharp-webbrowser-control The scrollbars can be removed by injecting a CSS style (for example via Javascript), i think it's "body.scroll" that has to be set to "no". From what i found from google, it's not possible to do that via C#. | ||
SRBNikola
Serbia191 Posts
On October 30 2011 22:43 Craton wrote: You'd have to give me an example on how to javascript rig it to start / full screen. My googling seems to imply that such a thing is impossible. Show nested quote + The ActionScript that initiates full-screen mode can be called only in response to a mouse event or keyboard event. If it is called in other situations, Flash Player throws an exception. http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7c5d.html How can I open a web browser through C# that has the bars at the top hidden and scroll bars disabled? I know you can normally do it through an html button with javascript tied to it, but I can't figure out how to do that in C#. --- Running the code below throws an error: ex = {"ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment."} frmBrowser is a form containing a WebBrowser control and nothing else. The earlier part of the code basically sets an alarm and when it goes off calls the second function. I set it to just wait 2 seconds for development purposes.
Program.cs
File: http://www.mediafire.com/?ef958apbjgn369b I condensed everything from the original project to this secondary project to try and weed out the problem, but I can't figure out how to solve it. There is C# function that lets u send mouse/keyboard inputs to other programs, as for your problem, there are few methods to detect default browser, and after u do that u can pass website with javascript edit: using System; | ||
defnotGeorge
United States80 Posts
| ||
DanceSC
United States751 Posts
you.rot(); for(int i=0; i < allYourFriends.length; i++){ allYourFriends[i].danceOnYourGrave(); } from a game lol | ||
Craton
United States17233 Posts
I came across the Invoke requirement in some of my googling, but didn't know how to apply it. I'll give it a try in a bit. | ||
frogmelter
United States971 Posts
Thanks in advance! This is what a have so far [well, parts of what I have. I think this is all the relevant information], error message is "‘void*’ is not a pointer-to-object type" on line "vector<string> wtf = *url;"
| ||
SRBNikola
Serbia191 Posts
On November 03 2011 08:04 frogmelter wrote: Does anyone know how to pass a vector as an argument to a pthread in C++? Thanks in advance! This is what a have so far [well, parts of what I have. I think this is all the relevant information], error message is "‘void*’ is not a pointer-to-object type"
Try accessing vector as an array? Maybe some foreach wrapper could help(or for -> with itr?)? | ||
frogmelter
United States971 Posts
On November 03 2011 08:26 SRBNikola wrote: Show nested quote + On November 03 2011 08:04 frogmelter wrote: Does anyone know how to pass a vector as an argument to a pthread in C++? Thanks in advance! This is what a have so far [well, parts of what I have. I think this is all the relevant information], error message is "‘void*’ is not a pointer-to-object type"
Try accessing vector as an array? Maybe some foreach wrapper could help(or for -> with itr?)? Sorry I forgot to mention - It errors out at the line "vector<string> wtf = *url;" I tested the print out in the main thread and it works, so I don't think that is the problem | ||
razzloss
Finland4 Posts
Then you'll just have to hope that the wtf in main stays alive long enough for the thread_func to make a copy of it, or use something like semaphores to signal between the threads that the wtf has been safely copied. | ||
SRBNikola
Serbia191 Posts
On November 03 2011 08:38 frogmelter wrote: Show nested quote + On November 03 2011 08:26 SRBNikola wrote: On November 03 2011 08:04 frogmelter wrote: Does anyone know how to pass a vector as an argument to a pthread in C++? Thanks in advance! This is what a have so far [well, parts of what I have. I think this is all the relevant information], error message is "‘void*’ is not a pointer-to-object type"
Try accessing vector as an array? Maybe some foreach wrapper could help(or for -> with itr?)? Sorry I forgot to mention - It errors out at the line "vector<string> wtf = *url;" I tested the print out in the main thread and it works, so I don't think that is the problem I think thats illegal in C++, what are u trying to do? | ||
frogmelter
United States971 Posts
vector<string> *vecPtr = (vector<string>*)url; for (vector<string>::iterator i = vecPtr->begin(); i != vecPtr->end();++i) { cout << *i << endl; } It was throwing an error before because it said that vecPtr had no class member called begin. But then I realized that it was a pointer to a vector, rather than the vector itself | ||
SRBNikola
Serbia191 Posts
On November 03 2011 12:31 frogmelter wrote: Ahhh I got it vector<string> *vecPtr = (vector<string>*)url; for (vector<string>::iterator i = vecPtr->begin(); i != vecPtr->end();++i) { cout << *i << endl; } It was throwing an error before because it said that vecPtr had no class member called begin. But then I realized that it was a pointer to a vector, rather than the vector itself Why don't you pass vector<string>* as argument of function instead of void* ? | ||
frogmelter
United States971 Posts
On November 03 2011 18:42 SRBNikola wrote: Show nested quote + On November 03 2011 12:31 frogmelter wrote: Ahhh I got it vector<string> *vecPtr = (vector<string>*)url; for (vector<string>::iterator i = vecPtr->begin(); i != vecPtr->end();++i) { cout << *i << endl; } It was throwing an error before because it said that vecPtr had no class member called begin. But then I realized that it was a pointer to a vector, rather than the vector itself Why don't you pass vector<string>* as argument of function instead of void* ? Arguments passed to pthreads must be typecasted to a void pointer. That argument can't pass more than 4 bytes, so the only way it works is to typecast it into a void pointer. I just had trouble getting it back into a format that I could read. | ||
| ||
![]() StarCraft 2 StarCraft: Brood War Dota 2 League of Legends Counter-Strike Super Smash Bros Heroes of the Storm Other Games Grubby13022 summit1g9797 FrodaN5092 ceh92031 shahzam669 Pyrionflax268 Liquid`Hasu233 Skadoodle97 ZombieGrub63 ToD32 JuggernautJason27 Maynarde24 HTOMario1 Organizations Other Games StarCraft 2 StarCraft: Brood War
StarCraft 2 • Hupsaiya StarCraft: Brood War![]() • musti20045 ![]() • LaughNgamezSOOP • sooper7s • AfreecaTV YouTube • Migwel ![]() • intothetv ![]() • Kozan • Laughngamez YouTube • IndyKCrew ![]() Dota 2 League of Legends Other Games |
Korean StarCraft League
PiG Sty Festival
MaxPax vs Classic
Dark vs Maru
SC Evo Complete
[BSL 2025] Weekly
Online Event
Replay Cast
SOOP Global
ByuN vs Zoun
Rogue vs Bunny
PiG Sty Festival
herO vs Rogue
ByuN vs SKillous
Sparkling Tuna Cup
BSL Nation Wars 2
[ Show More ] Online Event
Replay Cast
The PondCast
|
|