Jump to content
Xtreme .Net Talk

rifter1818

Avatar/Signature
  • Posts

    257
  • Joined

  • Last visited

Everything posted by rifter1818

  1. Does anyone know how the following could be tied into windows xp? 1) Custom desktop - id like to write a new program to manage the desktop, Icons would be able to have different sizes and free floating positions. Also just any information on writing a customized desktop/ accessing the data windows uses for its desktop and the "right click" menu that the windows desktop has. 2) Custom Start menu - reprogram the windows start menu. Reorganize / resize (height only) the items in the windows start menu, also have a program that keeps data on how often each item is used, search times etc... Does anyone know of any slightly less painfull ways of doing these, (writing a new OS, is a little out of the range for the time i have available for this). Thanks
  2. ok, it seems to me like something is acting as garbage collection on my c++ code, and i would like it to stop,.. every time i call a constructor inside a function by the time it exits that function the pointer i constructed is now pointing at nothing whatsoever.... ive found ways of avoiding it in some cases but not all and need help. What i want to word void construct(classtype1 *variable) { variable = new classtype1(); } works fine in the function but once it ends the function variable is now set to god knows what. however void construct(classtype1& variable) { variable = classtype1(); } is fine. So through my train of logic it would seem that this mysterious garbage collection (which to my knowledge of c++ shouldnt exist) seems to have decread that pointers are too hard to track and therefor dont exist outside of that function so it can go ahead and cleanup the variable i just created. This problem has caused me hours of headaches.. Is there any way to make the pain stop? Oh yes im using the win32 console application as im not coding in managed c++ (where having GC running would make sence to me). edit: another instance of this problem has been when i created a deque of pointers, in that case to various objects like... the asteroids in my asteroids game, then i created a function which added a pointer to this list, the function ran fine, i checked inside the function everything was fine, but once that function ended, the menace came and destroyed my asteroid, causing my application to crash when it tried to render the random garbage the pointer now pointed at.
  3. rifter1818

    Input

    Im working with C# and i need an input method that can ignore whitespace (from a file) something like c++'s ifstream would be great... inputing floats, strings and ints. Really soon would be nice too as the time i have to finish is measured in hours, thanks.
  4. the structs struct VECTOR { float x,y,z,w; }; and/or struct VECTOR { union { float v[4]; struct{float x,y,z,w;}; } } the challange so that x ( and v[0]) are alligned to a 16 byte boundary but y,z,w are not (come 4 bytes (1 float) after the previous variable) resoning being so that they can be copied into a XMM registry faster by using MOVAPS instead of MOVUPS. any ideas?
  5. ok i found what i should be doing, under project properties,debbuging, command arguments i put <in.txt >out.txt ive changed the build directory to the main directory however now it says that it cant run the application because the output file is invalid (cant redirect output...) however if i just put <in.txt as the arguments it runs but doesnt input(from the file)! any ideas? edit ive even changed it to <$(SolutionDir)in.txt >$(SolutionDir)out.txt which gets rid of the invalid file problem however it still inputs from keyboard and outputs to screen!
  6. this isnt so much syntax as it is the editor what i want is to set up the enviornment so i can add 2 text files to my project (in.txt, and out.txt) such that when i tell it run my program it will use in for input and out for output (command line arguments <in.txt >out.txt) where would i enter "<in.txt >out.txt", will there be a problem with the fact that the txt files are in the project directory while the exicutables are in 'debug' and what should be done to fix such a problem?
  7. its more of a theoretical collision detection, so the triangles could be any shape,...
  8. Didnt know what section to post this in (i know it really isnt .net related at all) but someone on here has to be sufficiantly stronger at math than me and know this. Say i have two triangles (in 2d in this case), both of which have known position,dimension,and velocities, how can i detect if they collide over a given time range. I tried to find a solution but i got lost Triangle one P0 P1 P2 moving at V0 Triangle two P3 P4 P5 moving at V1 (P,P0-P5 are all points V0,V1 are velocity vectors) closest i could realise is that with x being the time range i was looking for if there is a P such that P = ((P1-P0)*v) + (P0 + xV0) + ((P2-P0)*u) = ((P4-P3)*w) + ((P5-P3)*z) + P3 + xV1 such that v,u,w,z,v+u,w+z are all (floats) between 0 and 1 really no idea how to solve this since there could be 0 or infinite P's (not quite infinite due to limited percision but you know what i mean) and there are 4 free variables and one range. just going on a wild guess but im way off track any pointers?
  9. my problem is this, i have a class (we shall name A) inheriting class B and my compiler will not let my A::[memberfunction] access the private variables in class B, which of course through inheritance are now variables in class A. this is driving me nuts, it can be ignored in this case because its in a dll, so i can make everything in B public and just not include the should be private ones in the including header file. but shouldnt a class that inherits something be able to access its own members?
  10. Hi i was wondering where i could find some good tutorials covering VS 2003 maro editor. The thing i am wondering how to do with macros (now there will be more questions) is what event do i code so that i can add text whenever a .h file is created. for example if i wanted every header file created to start with #ifndef [headername]_[iD] #define [headername]_[iD] #endif and yes i know that you can use things like #pragma once, and im pretty sure theres a command line option that can be set in VS2003 but more important that just this use is how to do it, and where i can find easy to read help on coding the macros. I would assume that others probably would find this usefull too. Also on a side note over a year ago i found a macro (theres a link on this forum somewhere) that minimized all of the code when you loaded a project, if someone could post the link again or the code for the macro that'd be great. Thanks in advance.
  11. PlausiblyDamp Any chance i could get an example of using delegates. i tried delegate void PEVENT(Object Sender,EventArgs e); PEVENT[] FUNCS = {...}; Compiler did not agree that this was a good solution.
  12. Heres an odd situation ive got myself into, i want to create an array of what i would in C++ call function pointers,.. in a C# application... pretty much what i would like to create is a situation like this (void(Object,EventArgs))[] FPs = {fcNEW,fcLOAD,fcEDIT,fcWHATEVER...}; void fcNEW(Object Sender,EventArgs e){...} void fcLOAD(Object Sender,EventArgs e){...} //and so on if my choice of (void(Object,EventArgs)) didnt give it away i am using these as functions that will be used to handle events, click events on buttons in this case allthought that is errelevant. There are other ways of doing this, but this one seems intreaging enough to ask whether it can be done or not, also can you have null elements. (probably best explaned by a another code segment) void SetupButtons(string[] CAPTIONS,(void(Object,EventArgs))[] CLICKEVENTS) { for(int i=0;i<=CAPTIONS.GetUpperBound(0);i++) { cmdBUTTON[i].text = CAPTIONS[i]; cmdBUTTON[i].Click += new EventHandler(CLICKEVENTS[i]); } } Once again i know there are other ways of avoiding needing this array, but still, can it be done? and what needs to replace (void(Object,EventArgs)) ?
  13. oh yes and before i forget can you have inline function pointers? (/how?)
  14. Rather quite in here. Hmm thats rather suspicious as someone here must have the answers.... Anyways my pointing saga continues, ive found a few sites helping me with function pointers but they are so far failing to work, my compiler (VS.net 2003) wants to make all of my function pointers part of the class (not sure the right term here but 1 for each instance of the class aka bad thing (memory inefficiant and have to make constructers set them to point at the right functions therefor also slow....) so i have come up with the following solution (that may be a very generous usage of the term and when this invevitably fails will be edited to read idea...). Have each class member function call a global function pointer (and make them all inline to avoid extra code usage) (efficiancy is key meaning its a bad idea for me to code it but its too late to change that) this also solves the problem that i couldnt figureout/find a way to make operator pointers (ohh the error descriptions where entertainment though)... so my suggestion //in vector.h class __declspec(dllexport) VECTOR { public: union { float v[4]; struct{float x,y,z,w;}; }; inline void ADD(const VECTOR&); }; //in vector.cpp void (*ADDF)(VECTOR& Dest,const VECTOR& L,const VECTOR& R); void ADDSSE(VECTOR& Dest,cosnt VECTOR& L,const VECTOR& R) { ....//wouldn't actually bother using sse for addition but its just an example } void ADD3DNOW(...) { ... } inline void VECTOR::ADD(const VECTOR& r) { ADDF(this,this,r); //can i do that pass it as a const and a non constant byref argument? } and id have the DllMain() assign ADDF to the proper function... oh ya by the way this is all in a dll just to make it easier. Next Question since all of my functions are inline will it work if a inline function inside a dll is called (from outside the dll) and it calls an inline function... oi 1) what will the compiler do and before you answer that 2) do i want to know... And of course the really important question will this work? how bad an idea is it? and of course any pointers on better ways to do this etc would be appreciated.
  15. Thinking about it Can i generalize somehting like that or doing it that way would i have to set the function pointer for each instance of the class?
  16. Well im lost doinging things well outside my current c++/c knowledge but that hasnt stopped me before. What i want to do is at startup change the code paths of a few different functions, im pretty sure (at least some of them) can be done using function pointers (the how part is what im sketchy on). I know that the DirectXExtensions uses something like this so it can support SSE,3DNow etc.. which is what im trying to do funny enough. first type of functions would be member functions... Vector::Add(Vector V1,VectorV2); .... and i would want to have multiple implementations of this function depending on what cpu is there.... my first thought on it (with my limited knowledge of function pointers) was something like this. class Vector { friend class FUNCTIONPOINTERALLOCATER; // its init calls change all the function pointers to the correct ones... protected: Vector (*ADDDEFAULT)(Vector v1,Vector v2); public: Vector Add(Vector v1,Vector v2,Vector (*ADDFUNC)(Vector V1,Vector V2) = ADDDEFAULT); } and have the class FUNCTIONPOINTERALLOCATER choose the right function for *ADDDEFAULT.... Second thought came to me instantly thats pretty stupid.... class Vector { friend class FUNCTIONPOINTER....;// public: Vector (*ADD)(Vector v1,Vector v2); } again having *ADD pointed to the right function..... which might work im not sure how efficiant it would be but i cant see it being too bad... (ive been wrong before) leaving question 2. is there a better way to do this? and question 3) operators if i can do it for member functions i can do it to operators right? please say yes.... and how. Thanks in advance, ive searched the net for almost two days looking at everything i can read on function pointers but all that lead me to was something simular to the first method. ps And please dont say why bother D3DX allready has a good vector class. If you want an explination, "You dont have to reinvent the wheel but you should know how the wheel works before you use it" is about my philosiphy on the subject. and there are other uses (besides my quest for knowledge) for such things...
  17. To clarify 1) When you right click on a file and select "Open With" (or double click on a file with an unknown file extension) windows opens up a form with a list of programs and a browse feature to choose what program to open that file with... Just wondering if i can send a filename to that or if i have to code my own.
  18. Couple of (hopefully) quick questions here. 1)I've been using Process.Start(filename) to open programs and files fine for a while now however if its a filetype with no known extension is there anyway to open the windows openwith dialoge? or do i have to code my one in which case how do i access the list normally provided by windows in said dialoge. 2)If i was to write a text editor, (C#) how would i access the data from a file opened with my text editor. 3) How would i (through code/ in the setup program) tell windows to use my application for certain file extensions? C# for answers is appreciated but any answer is great thanks in advance.
  19. Very true, however if one wanted to really stop terrorists, they would attack them but instead would attack thier backing. A single radical leader isnt really that much of a threat, now if he has thousands of people backing him there might be a slight problem. Dont focus on the leader as the problem the problem is people (en mass) are following him. In other words instead of sending bombs send aid, make the general public agree with your cause and less of them will join in against you. One way to insure that it does happen in your lifetime might be [for the US]to continue invading countries with stratigic resources. As for economic/goverment systems, my suggestion has allways been a community level (or maybe province/state level) elected communism (yes you can have democratic communisms(well more socialism but that difference is mostly in how communism has been slanderd to try and justify the cold war)) which then makes up a parlement like system with equality between each community leader and no "top dog" it might be harder to get some things done but it makes it much harder for large scale corruption.
  20. Fair enough. He was Impeached.... Id argue that your choice to ignore the rest of my post was in error but oh well.
  21. I personally can't see how bush has so many supporters Im sorry im oppinioned so here it goes. 1)removed because i was in error. 2) its no big secret that bush is manipulating everything he can to get his friends (and himself) richer than they allready are. now i agree aiming to get richer is not a bad thing, screwing over your nation and most of the world to get your little possy rich on the other hand. 3)A person on the http://www.xtremevbtalk.com/showthread.php?t=191539 said that Suddam Housain offered to harbor Osama bin Ladan, proof of this i would like to see they hate each other only marginally less than they hate america. Also on this site someone argued that america shouldnt dissarm its nukes to assure the MAD(Mutually assured distruction) Well lets see first of MAD is a very stupid policy but im not here to argue America should scrap it, id just point out they dont need nukes for MAD they have more than enough other weapons to blow the *** out of any CONTINENT that pisses them off. Not only that but Nuclear warheads arnt designed to take out military targets Nukes are designed to kill civilians plain and simple. NUCLEAR WEAPONS ARE WEAPONS OF TERROR! its what they were designed for ex Nukes were first used (by america no less) to kill enough japanese CIVILIANS to scare them into submission.(not only that but the radiation.....) 4)Bush is using the fact that he has power to commit War crimes. Lets say north korea got pissed of one day, really pissed of, so they went off to the UN and said "look boys those damn *random people*Vietnameese are really pissing us off so we want to take out there leader" as is predictable the un said no we'll work it out some other way. Anyways little while later north Korea decides enough is enough and invades Vietnam (chosen for no real reason by the way i have nothing against the people of vietnam) what do you think would happen? UN would sit by while North Korea killed over 7000 Vietnameese civilians? I think not. 5)Bush is single handedly (well not quite) destroying the american economy, this is bad not just for america but for the world as much of the global econmy is influenced by the american economy. 6)WAR on terror = BAD IDEA. Why WAR CREATES TERRORISTS. If i had an army and it was my goal to make a group of people hate me, hate me as much as i possibly could how might i do it? KILL SOME OF THEM. then occupy thier country, and through in one of my buddies as leader. Im sure afghanistan loves america now. 7) War in Iraq again bad idea, want Suddam hussien dead assasinate the ******* dont invade his country, while it wouldnt be easy im sure a large scale special ops sorta deal would have done it better, and not lost 1000 american troops, who knows how many iraqi troops and over 7000 civilians. 8)want to make sure that justice is done to those responcible on 9/11 ive got just the ticket, 1st fly out any and all members of the Ringleaders family without proper questioning, Second try and shut down any and all private investigations into the incident. Third when a large group of victims decide to sue one of the nations from which the terrorists came supply your layors... to fight AGAINST this lawsuit. then release some military records, itll make you look credible, just censor out the parts that link you with the Ringleaders folks, that'd really look bad. While your at it annex the oppertunity to invade some oil country, then shift all of the focus over to this new war and away from the fact that you havent even caught the ringleader yet. "I don't know where he is.You know, I just don't spend that much time on him... I truly am not that concerned about him." saying something like that really inforces the fact that your out for justice. and the list goes on and on, anyways folks just my humble oppinion, Dont Like Kerry or Nader perticulary just bush has to go! (not for "Gods Sake" for everyones sake)
  22. Darn i was almost sure there was a way of editing Embedded resources (as counter intuitive as it sounds). Oh well guess its just gonna have to go in a regular text file....
  23. The Challange to store a collection of hashtables(String Keys, Int Values || Doesnt have to be hashtables there just what i know how to use in c#, closest thing i know to good old maps in c++) for All the Files,Directories, And others (My Computer,drives,recyclebin...) as an embedded resource in an executeable that can be edited while the program is running (loads at startup saves at shutdown & or Backup Points). I guess ill break it down into two seperate questions 1) How would i add a textfile (something i can access with StreamReader/StreamWriter) as an embedded resource and access it with a) a StreamReader, and b) a StreamWriter. 2) Any suggestions on how to efficiantly store and access this data (which as im sure you can guess will get quite large very quickly)? Thanks in advance
  24. 1) How do i get the icon Assosiated with Folders and "Special things"(My Computer, My Network Places, Recycle Bin etc)... Currently im using the following code to get Icons (and extra info) for files. [structLayout(LayoutKind.Sequential)] public struct SHFILEINFO { public IntPtr hIcon; public IntPtr iIcon; public uint dwAttributes; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] public string szDisplayName; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)] public string szTypeName; }; class Win32 { public const uint SHGFI_ICON = 0x100; public const uint SHGFI_LARGEICON = 0x0; // 'Large icon public const uint SHGFI_SMALLICON = 0x1; // 'Small icon [DllImport("shell32.dll")] public static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttributes, ref SHFILEINFO psfi, uint cbSizeFileInfo, uint uFlags); }; //...... IntPtr iconhandle; iconhandle = Win32.SHGetFileInfo(FileName,0,ref shinfo,(uint)Marshal.SizeOf(shinfo),Win32.SHGFI_ICON|Win32.SHGFI_LARGEICON); //.... icon.Image = Icon.FromHandle(shinfo.hIcon).ToBitmap(); I assume this will not work if i sart plugging in directories under filenames... 2) What is the path of the current Desktop.. foreach(string S in System.io.Directory.getfiles(???????)) 3) What do things like My Computer and Recycle Bin fall under for System.IO.Directory.getfiles(),System.IO.Directory.getdirectories()...
×
×
  • Create New...