|
You would need to access the disk io API directory. Then via that
1. Find the contiguous clusters.
2. Mark them in use
3. Attach them to a file
4. Then write to the file, being careful to not exceed the maximum.
Naturally the application must also have permissions to access the API.
|
|
|
|
|
Hey there,
I am working on an MFC app that uses CDHtmlDialog class to create a dynamic HTML page.
Now i want to pass/stream a image pointer to the HTML page to show it to the users.
The image will be stored in the hard disk, and the MFC should have a way of streaming this to the HTML page for display on a particular user event.
I am not sure how to convert a JPG or GIF file into something else that i can pass to the HTML page.
Possibly as an argument to JavaScript function residing in the HTML page.
Any help is welcome. Please guide with sample codes.
Thanks in advance.
|
|
|
|
|
If it's a file on the HD simply use an image tag with a file URL[^].
Steve
|
|
|
|
|
|
Hi, dear all,
I have a program created using C++ MFC which works fine in USA, but when this program is used in Europe like Norway, the data is messed up. What I want to do is set the regional and location to US English always when program executes, how can I do it? Thanks you very much!
|
|
|
|
|
Is setlocale() or SetThreadLocale() of any help?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
what are enumerator and how it is different from struct & class
please explain all with some examples . i am beginner in c++
|
|
|
|
|
|
I need to generate variable sound ( system speaker is fine for now) , both in frequency (audio) and length (code). I do some processing in worker thread and I did tried Beep in worker thread , it is synchronous ( not really an issue) but it terminates the thread when completed. No good.
I tried MessageBeep and it did not do a thing, wrong audio anyway.
So is PlaySound (from a file) my only choice and if so how do I control the length of the "play"?
Any constructive suggestions are as always appreciated.
Cheers
Vaclav
|
|
|
|
|
Vaclav_Sal wrote: ...how do I control the length of the "play"? Have you experimented with the various SND_xxx flags?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Vaclav_Sal wrote: I did tried Beep in worker thread , it is synchronous ( not really an issue) but it terminates the thread when completed.
Beep does not terminate a thread, but your code may do so. You could easily write a method that repeatedly calls Beep and run it in a thread that does not terminate.
Veni, vidi, abiit domum
|
|
|
|
|
Richard,
I'll get back to you on this one. The section of code in question is "broken".
I hope you are right and I had something else doing the deed.
But I checked elsewhere and really did not pull the silly idea of Beep terminating the thread out of my hat. Of course now I cannot find the source!
Right now I think the Beep is run in its own thread and what I saw in debug was message terminating that thread.
Thanks for your help.
Vaclav
|
|
|
|
|
The problem is you never give us all the information necessary to try and offer suggestions. You stated earlier that Beep() terminates a thread, but now you cannot find the source. So we have no way of even guessing what your code may be doing.
Veni, vidi, abiit domum
|
|
|
|
|
Hi,I read some articles, some say enum constant not ocuupy storage in memory, some say it does.
I wonder, for example, enum Weekday {sun,mon,tue,wen,thu,fri,sat}, then where is the Weekday be stored at?
And I want to declare a enum consant like:
enum XXYY {xx1=100,xx2=3000,yy1=4500,yy2=32}, is that ok? or
have to define: enum XXYY { xx1=32,xx2=100,yy1=3000,yy2=4500}?
|
|
|
|
|
The enum members can have any int value. All of them can have the same value, they can have random order.
The only two "rules" that you have to know: If you don't define the value of the first enum member then its automatically 0. If you don't define the value of any of the other non-first enum members then their value is automatically the value of the previous member + 1. Using enums to declare constants in header files (even inside classes) is a good old trick. If you use the enum just to define constants then you dont have to give a name for the enum itself:
enum {
val0 = 5,
val1 = 1,
val3 = 4,
};
EDIT: The weekday enum itself is just a type. A type doesn't occupy any memory. If you declare/define a variable of that enum type then the variable occupies some memory, the same amount as an int variable:
Weekday wd;
void func()
{
Weekday w;
enum Weekday ww;
}
class C
{
private:
Weekday m_Weekday;
};
|
|
|
|
|
Hi all. I am trying to compile open source CamStudio project. I have been able to compile the project with no errors. But when I run it in debug mode, it gives 2 debug assertions.
1 - Debug Assertion Failed: ..... \atlmfc\include\afxwin1.inl Line: 24
2 - Debug Assertion Failed: ..... \src\mfc\docsingl.cpp Line: 219
3 - Unhandled Exceptions.
Now if I keep ignoring them, it runs the project. I can record my desktop, my voice etc. What could be the cause for these debug assertions and how to remove them. Thanks.
|
|
|
|
|
Django_Untaken wrote: What could be the cause for these debug assertions Anything at all. You need to look at the code in order to find out what they are complaining of, and use your debugger to try and resolve them. However, since this is open source you would be better asking the question at the site where you got the code from.
Veni, vidi, abiit domum
|
|
|
|
|
Hello all,
I am using CDHtmlDialog to create a simple MFC app. I want my app to do the following things.
Load images by using the MFC code to the DHTML page.
Change texts in the DHTML page using the MFC code.
Capture DHTML button cicks inside the MFC code and based on that change the images & texts.
For the 1 & 2 i am planning to do that inside a TIMER or Thread and dynmically change them for user.
I am able to make a simple app, but what am struggling with is changing the images & texts in DHTML page from the MFC code.
Can someone tell me how to do that?
A sample app or code will be great.
Thanks in advance.
|
|
|
|
|
|
No profile, 7 messages, a name like 'Don Guy' and English is not your native language?
Go on, stop pretending to be American in order to get your quesitons answered. Tell us who you really are.
modified 3-Sep-13 9:52am.
|
|
|
|
|
Hi,
i need to create multithreaded environment in my Unit-testing activity. For that i need to create multiple threads which can handle methods individully. And these mthods having different parameters & return types. So as per requirement i'm trying to create thread by using CreateThread().HEre the the thread can handle mehtod like in this format "DWORD WINAPI Function( LPVOID lpParam )
"
Hence my questrion is that , how can we create thread using C++ to hadle method having 'different type of method parameter' & 'method return type' as well.
Please help me soon. Thanks
|
|
|
|
|
pk jain wrote: how can we create thread using C++ to hadle method having 'different type of method parameter' & 'method return type' as well. You don't; you create function calls to call different functions/methods. Running such calls in different threads may or may not be necessary, depending on the test environment.
Veni, vidi, abiit domum
|
|
|
|
|
I can help you in threading because your problem is simple, I would do this with a task object queue (threadpool) but do you think you need multithreading for this? You are calling different methods of objects from different threads within the same process? You can test only threadsafe methods that don't interfere with each other this way. I would rather do this with multiprocessing instead of multithreading. You start several processes each of them performing a different test. This way each process has only one main test thread but these main/test threads dont interfere with each other because they are isolated in separate processes. Sometimes multiprocessing is the winner especially when you are using a non-threadsafe library. So why do you want to use multithreading?
|
|
|
|
|
And these funcitos he is tesing are going to run in seperate processes are they? How likely is that? Perhaps they do share data and use mutexes to manage this and the entire POINT of testing is to make sure they work in the SAME process? Ever thought of that?
|
|
|
|
|
Thanks again for your comments. Have you finished reading my post? The last question tries to find out the intentions of OP. Most of the well written modular multithreaded applications are built up from single threaded components containing the least possible locks and synchronization points between threads that work with separate instances of these single threaded modules. Since the components are usually single threaded most of the test cases are also single threaded and test the functions of a module. It's okay to create a few test cases to test the multithreaded interactions and synchronization points but this won't be the majority of the test cases. Parallelization of test cases within a single threaded component can be achieved safely only with multiprocessing. Actually I've worked on systems that were developed with lots of test cases and some of these systems were multithreaded and some of these were well designed at the same time.
|
|
|
|