|
what about opening mci Device?
there is nice code for this in msdn:
UINT wDeviceID;
DWORD dwReturn;
MCI_OPEN_PARMS mciOpenParms;
// Opens a CD audio device by specifying the device name.
mciOpenParms.lpstrDeviceType = "cdaudio";
if (dwReturn = mciSendCommand(NULL, MCI_OPEN, MCI_OPEN_TYPE,
(DWORD)(LPVOID) &mciOpenParms))
{
// Error, unable to open device.
}
// The device opened successfully; get the device ID.
wDeviceID = mciOpenParms.wDeviceID;
4apai
There're no impossible tasks. There're tasks that required infinite period of execution time.
|
|
|
|
|
You Are Right as Always $api
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Hi all,
I am writing a program in vc++.
i would like to generate one time password.I have no idea.
Please help me.
rajesh
|
|
|
|
|
do you wanna know the program tools or pattern?
in first case look for rand, random, randomize and so on.
then the algorythm is following:
1. create the enumaration with the char symbols that can appear in password
2. create cycle of password length and for every iteration get random integer value which will be the index in the enumaration. add the char symbol to the end of password.
does it fast your problem?
4apai
There're no impossible tasks. There're tasks that required infinite period of execution time.
|
|
|
|
|
Friends,
I want to programatically determine whether the control is currently enabled or not. E.g
I dropped an edit box on a dialog. The object is m_myeditBox . In OnInitDialog() i made edit box, disabled by using m_myEditBoc.EnableWindow(FALSE) . Later in the program i want to determine whether the control represented by m_myEditBox is currently enabled or not. How can i do so
Imtiaz
|
|
|
|
|
Try m_myEditx.IsWindowEnabled() that should return the information you want.
Mike
|
|
|
|
|
Hi,
I've registered an application, under Windows XP, using 'instsrv.exe' and 'srvany.exe'. This all works fine, but when i stop the service i want to clean up any used resource, and this is where it gets 'tricky'. The service is completely shutdown, no destructors called or anything like that. I'm also not able to catch some kind of 'kill' interrupt using 'signal' (used to catch SIGINT (CTRL-C) interrupts).
Does anyone know a solution or another 3rd party service registration tool that provides some method of catching a stop service command?
Many thanks
Er zit een korstje op mijn aars.
|
|
|
|
|
Hi there,
I have the following (simplifed!) situation:
struct abc {
CString a;
double b;
long c;
...
};
I could do as follow:
CString s;
s.Format("INSERT INTO myTable (a,b,c) VALUES (%s,%g,%d);",abc.a,abc.b,abc.c);
and execute a CDaoQueryDef
OR ....
and here your geniality is requested!!!
Is there any way to pass in one shot the arraydo something like:
s.Format("INSERT INTO myTable () VALUES (%???);", abc); ->Would/Could it work???
^
|
which data type??
and again execute the famous CDaoQueryDef.
My "abc" struct cound cointain a good dozen of elements and passing each single one could become somehow "problematic", especially if one has different long structs;
Otherwise some additional idea?
Every suggestion is more than welcome.
Thanks and Regards
Filippo
|
|
|
|
|
You can implement global function that gets yuor struct as argument format your data and return string
LPSTR FormatStruct(abc a_abc) {
...
}
an then:
s.Format("INSERT INTO myTable () VALUES (%s);", FormatStruct(l_abc));
or you can implement this functiona as a struct method
struct abc {
...
LPSTR FormatStruct() {
...
}
...
}
s.Format("INSERT INTO myTable () VALUES (%s);", l_abc.FormatStruct());
Complex operator=( Complex &other );
or overwrite operator = in struct to return string...
WTF u want...
4apai
There're no impossible tasks. There're tasks that required infinite period of execution time.
|
|
|
|
|
The insert statement needs to know how to unpack the data so in general no, you can't do that.
Also, I would look at using parameterized queries. If you are using SqlServer it will improve performance by better utilizing the execution plan cache.
i.e.
INSERT INTO myTable (a,b,c) VALUES (?,?,?)
Where ?,?,? mark the three parameters of the query.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I'm developing a program by GDI but I has a knotty problem when i use the function pDC->SetMapMode(MM_LOMETRIC);
When it runs on my computer is good but shapes(as ellipe, square, circle,...) are crooked when my application runs on other computer, I don't know why... Please help me...thanks.
|
|
|
|
|
MM_LOMETRIC Each logical unit is mapped to 0.1 millimeter. Positive x is to the right; positive y is up.
The definition is copied from MSDN. But the PC doesn't magically know how big a pixel is. It has to
go from the DPI set. So I suspect that the other PC has "big fonts", which changes dpi, or very
different resolution.
For example, my monitor at home is 1280 x 1024, and slightly longer than it is high. So X pixels
is pretty close to the same length in either direction. A square would come out square.
But my laptop is physically similar, but is 1400x1040. That square would come out rectangularly.
That is the probable reason. How to fix it is a little harder... You could get the user to set
the physical size of the screen. From there you can set a map mode which will allow you to draw
in "real" dimensions. Sounds easier than it is.
You may want to look at a ruler control from the miscellaneous controls on CP.
Iain.
|
|
|
|
|
I'm developing a program by GDI but I has a knotty problem when i use the function pDC->SetMapMode(MM_LOMETRIC);
When it runs on my computer is good but shapes(as ellipe, square, circle,...) are crooked when my application runs on other computer, I don't know why... Please help me...thanks.
|
|
|
|
|
I have written a code like this in visaul c++ using a win32 API function in a WIN2000 Proffessional.
#include <windows.h>
#include <winbase.h>
void main()
{
CopyMemory((LPVOID)0xffffffff,(void *)0x0000ffff,1);
}
i am getting an error The instruction at "0x00408410" referenced
memory at "0x0000ffff". The memory could not be "read".
I am gettinng the same error when i try to access a memory address of any hex value.
Wot could be the problem?
Thanks in advance!!,
Abin.
|
|
|
|
|
fortunately os protect data from unathorized use. u can't simply overwrite data memory by specifiing it address.
void CopyMemory(
PVOID Destination,
const VOID* Source,
SIZE_T Length
);
Destination - Pointer to the starting address of the copied block's destination. (this must be a defined variable)
read msdn to know more.
4apai
There're no impossible tasks. There're tasks that required infinite period of execution time.
|
|
|
|
|
Hi !
I need to implement some logging in my app. As I don't want to reinvent the wheel, I did some searching for a logging framework.
I found log4cpp and log4cxx, but I find it difficult to choose. Does anyone of you use one of these ? Are you facing some problems ? OR do you know of another logging framework that you would recommand ?
Thanx for your suggestions,
Jerome
|
|
|
|
|
what about to write your own logging system? it doesn't take much time and you can simply adjust it to your needs. i recommand it.
it consists of singleton class with method that add records to the log file. you can write also time, thread_id, process_id, variables values, states and so on...
4apai
There're no impossible tasks. There're tasks that required infinite period of execution time.
|
|
|
|
|
Jerome Conus wrote:
I need to implement some logging in my app.
If the quantity of data is small, you could use the system's event log. It has it's own API.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I looked at lots of logging packages about a year ago for Surfulater and in the end used AMLOG which you'll find here on CP. I had various problems with other loggers and some were just too big and complex for my needs.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
Hello,
I need to insert a dialog windows in to a nother dialog,
Well I have i MFC app and I need to make a type a Wizard.
And I have check but don't find a good one on this site. So how can I make a dialog apare in my dialog?
Is there a fast way to do this? Please help me.
|
|
|
|
|
He he
You can use the win32gui library.
(http://www.torjo.com/win32gui/)
It's extremely easy to have a dialog (A) on another dialog (B).
On dialog B, just insert a static control (a label), and give it the ID of the dialog A (for example, IDD_SAMPLE). That's it!
Best,
John
John Torjo, Contributing editor, C/C++ Users Journal
-- "Win32 GUI Generics" -- generics & GUI do mix, after all
-- http://www.torjo.com/win32gui/
-- v1.4 - true binding of your data to UI controls!
+ easily add validation rules (win32gui/examples/smart_dlg)
|
|
|
|
|
Thanks i will use that,
You are a life saver.
|
|
|
|
|
do you have to have the win32gui library you spoke of to insert dialog B onto dialog A in the static control? Or is there some specific property you have to set? I tried it and can't get it to work.
[insert witty comment here]
bdiamond
|
|
|
|
|
He he
Of course you need the win32gui library
Besides, if you really want something fun (smart dialogs) - you can check out the win32gui/examples/smart_dialogs examples.
(true binding of your data to controls)
Best,
John
John Torjo, Contributing editor, C/C++ Users Journal
-- "Win32 GUI Generics" -- generics & GUI do mix, after all
-- http://www.torjo.com/win32gui/
-- v1.4 - true binding of your data to UI controls!
+ easily add validation rules (win32gui/examples/smart_dlg)
|
|
|
|
|
hello,
I've the following problem:
1) two files one with data and another one with header about data's file
2) I need to insert the header into the data file at the beginning of file
3) I tried using Createfile in this form
<br />
tempfd=CreateFile(filename_save, GENERIC_WRITE|GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_ALWAYS, NULL, NULL);<br />
but when I use the ReadFile, it returns error 183, that's defined in msdn ad
<br />
183 Cannot create a file when that file already exists. <br />
My idea was to copy the content of two files in memory, than paste the header into data file, than append the data file, but doesn't seems to work, any suggestion??
Thanks in advance
Paolo
|
|
|
|