|
o,thanks!
and can you tell me how can i go to the "windows developer".
is it in msdn?
|
|
|
|
|
|
thanks very much.
|
|
|
|
|
Hi,
I'm trying to set a value to a new key I created, and I get an ERROR_ACCESS_DENIED error when I use RegSetValueEx. Here's some code:
lRes = RegCreateKeyEx( HKEY_CURRENT_USER,
LoadStringEx( IDS_REG_FOLDER ),
0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS , NULL, &hkSub, &dwDisposition);
if( RegOpenKeyEx( HKEY_CURRENT_USER, LoadStringEx( IDS_REG_FOLDER ), 0, KEY_QUERY_VALUE, &hKey ) == ERROR_SUCCESS )
{
// Store ID
lRes = RegSetValueEx( hKey, LoadStringEx( IDS_REG_Q_STOREID ), 0, REG_EXPAND_SZ, (BYTE*)strStoreID.m_str, strStoreID.Length()+1 );
// Entry ID
lRes = RegSetValueEx( hKey, LoadStringEx( IDS_REG_Q_ENTRYID ), 0, REG_EXPAND_SZ, (BYTE*)strEntryID.m_str, strEntryID.Length()+1 );
}
What am I doing wrong???
Thanks!
---------------
Concentrating on Ideas
http://www.edovia.com
|
|
|
|
|
Two things: Your RegOpenKeyEx() is redundant. Use the HKEY returned by RegCreateKeyEx() .
And never use KEY_ALL_ACCESS . It will fail on NT for non-admin users. Only ask for the access you need.
--Mike--
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
And never use KEY_ALL_ACCESS. It will fail on NT for non-admin users. Only ask for the access you need.
It will fail even though the root key was HKEY_CURRENT_USER? (which was the case in the original poster's code).
|
|
|
|
|
Yes, it can fail because of policies created by the domain admin.
KEY_ALL_ACCESS include WRITE_DAC and WRITE_OWNER and domain admins can be quite sensitive about them.
"In an organization, each person rises to the level of his own incompetence." Peter's Principle
|
|
|
|
|
i have a printer , the printer only can print the ascii character
but cant print chinese.the print can print bitmap usering its own
printing command.now i choose this method in win2k:
i want to TextOut some chinese characters in the memory then generate
the bitmap in memory ,deal the memory bitmap ,get the pixels then get
the print data
for example:
......*******.........
......*******.........
......*******.........
......*******.........
this is a bitmap .now i get the per pixel and generate data
;;0x80 represent white pixel
;;ox81 represent black pixel
0x80 0x04 0x81 0x07 0x80 0x04
0x80 0x04 0x81 0x07 0x80 0x04
0x80 0x04 0x81 0x07 0x80 0x04
0x80 0x04 0x81 0x07 0x80 0x04
but how can i generate this data from a bitmap in the memeory?
who can help me?
-----------------------------
Mr.Whelk
-----------------------------
Zhuhai City ,Guangdong ,China
|
|
|
|
|
Try creating a black-and-white bitmap. Select it into some DC. Blit the source DC's bitmap into this bitmap, and then it's up to you to read the bits of that bitmap (hint: GetDIBits).
Wasn't there a mountain of examples for writing Windows 3.1 printer drivers, including a complete printer driver devkit?
Search MSDN and you'll find.
|
|
|
|
|
sometimes i can built a printer driver ,this cause the installation of the application is complex.i want to realize it in my application then this is
good to customer.
-----------------------------
Mr.Whelk
-----------------------------
Zhuhai City ,Guangdong ,China
|
|
|
|
|
I'm not 100% sure I understand you, but it seems you are trying to output something on a printer that is not (currently) supported by windows.
It also seems you only want to 1) get the bits (in B/W) from the source bitmap, and 2) somehow output them to that printer, bypassing the printer driver.
For the latter, I suggest you just CreateFile() or even fopen() "LPT1:". If that's not an option, have a look at the GDI API function Escape().
For the former, I suggest you follow my earlier suggestion.
From these two suggestions you should be able to produce the output (since it seems you know what the printer needs).
++luck;
|
|
|
|
|
yeah,what you say is right!
1:i use the CreateFile() open the LPT1 then send the printer command
for example print bitmap
0x14 0x47
sometimes i will generate the send data:
0x81---black pixel
0x80---white pixel
0x80 0x04----continuse 4 white pixels
0x82---line end flag byte
0x84---data end flag byte
0x1c,0x47,0x95,0x00,----------------->command and the length
0x80,0x04,0x81,0x03,0x80,0x0a,0x81,0x01,0x82,
0x80,0x05,0x81,0x03,0x80,0x09,0x81,0x01,0x82,
0x80,0x05,0x81,0x03,0x80,0x09,0x81,0x01,0x82,
0x80,0x05,0x81,0x03,0x80,0x09,0x81,0x01,0x82,
0x80,0x05,0x81,0x03,0x80,0x09,0x81,0x01,0x82,
0x80,0x05,0x81,0x03,0x80,0x09,0x81,0x01,0x82,
0x80,0x05,0x81,0x03,0x80,0x09,0x81,0x01,0x82,
0x80,0x05,0x81,0x03,0x80,0x09,0x81,0x01,0x82,
0x80,0x05,0x81,0x03,0x80,0x09,0x81,0x01,0x82,
0x80,0x05,0x81,0x03,0x80,0x09,0x81,0x01,0x82,
0x80,0x05,0x81,0x03,0x80,0x09,0x81,0x01,0x82,
0x80,0x05,0x81,0x03,0x80,0x09,0x81,0x01,0x82,
0x80,0x05,0x81,0x03,0x80,0x09,0x81,0x01,0x82,
0x80,0x05,0x81,0x03,0x80,0x09,0x81,0x01,0x82,
0x80,0x05,0x81,0x03,0x80,0x09,0x81,0x01,0x82,
0x80,0x05,0x81,0x03,0x80,0x09,0x81,0x01,0x82,
0x84
so send these data on printer by LPT1 ,the printer will print the bitmap
2: now my problem is that i want to built a function:
char * GenerateData(CString strPrintText);
these function can change the strPrintText to above data format;
the argument strPrintText is chinese character
the return is the data above
the key is that i dont know how to generate the strPrintText to the bitmap in
the function ,by the way ,i dont want to display the text,all i want to is to
generate the data .then get the bitmap data to generate the data format above.
that is all .i hope you can help me.thanks a lot.
-----------------------------
Mr.Whelk
-----------------------------
Zhuhai City ,Guangdong ,China
|
|
|
|
|
Mr. Whelk,
If you receive this before you receive my personal mail, please excuse me for jumping to the conclusion you mailed me in person and not posting to CodeProject. There could have been e.g. web-site delays I didn't think of.
Anyway, my answer would still be:
the key is that i dont know how to generate the strPrintText to the bitmap in the function ,by the way ,i dont want to display the text,all i want to is
to
You are able to display it I assume? Then:
If you are drawing these glyphs into the output DC, you already know how to
draw them, and just have to draw them to another bitmap that you yourself
then interpret.
If you are not drawing them into the target DC, but want to print them anyway, you have to 1) create a bitmap, 2) blit (blt = copy) the contents of
the source bitmap into your created bitmap and then finally 3) interpret the
bits.
To interpret the bits I can only suggest you read up on "CreateDIBSection"
and "GetDibIts".
++luck;
|
|
|
|
|
sorry i cant do it
can you give a example application to realize the function?
thanks a lot !!
-----------------------------
Mr.Whelk
-----------------------------
Zhuhai City ,Guangdong ,China
|
|
|
|
|
Is this the right algorithm to resume an aborted partially downloaded file from the point it was aborted?
1. Read the number of bytes already download = x bytes
2. Inform the server how much of orginal bytes have been read
so remaining bytes = (total file size) - x
3. seek to the point it was aborted in the file using CFile::Seek() and start reading from the server
4. At the client side move the file pointer to last bit of the read byte using CFile::Seek() and make sure it doesn't overwrite the existing file. Am I on the right track guys? And how do I prevent the file from not over written?
Have a good one guys.
"My ass on fire and my brain's on smoke"
|
|
|
|
|
Licensed2Code wrote:
Is this the right algorithm to resume an aborted partially downloaded file from the point it was aborted?
No. But you're close.
Note that without telling explicitly what file transfer protocol you are using you can't get precise answers.
If you are using FTP; Instead of asking, do your own research (also know as "Please do your own googling"). Have a look at e.g. FileZilla that does this (and more).
|
|
|
|
|
I'm using TCP/IP to transfer some raw bytes.
Ok, as you said, I'll do my own research. I came to ask this when my own research isn't good enough, and I was trying to share my knowledge with the rest of ya'll. Ever thought of the purpose of this news group?
Thanks for replying though.
|
|
|
|
|
hi, i am (trying) to learn assembly and downloaded MASM. This includes many examples, but they all seem to be using include files and working with messageboes just like in C, in fact i dont really see why i should use Asm instead of C. I mean, where is the code behind, for example CreateWindow(), either in C or in Asm, how is it done? down to the very basics... If anyone knows a good tutorial on this or anything it would be greatly appreciated.
Thanks
Kuniva
--------------------------------------------
|
|
|
|
|
Kuniva wrote:
in fact i dont really see why i should use Asm instead of C
There is often no reason to use assembler instead of C. Since I don't know where you got that idea, it's impossible to judge it more than saying it's in general false.
|
|
|
|
|
win32 asm tutorial[^]
You may download asm books on k*z*a as well/.
if you start putting in too manay features, it no longer remains useful for beginners
quote in a CP article comment, shiraz baig
|
|
|
|
|
Kuniva wrote:
I mean, where is the code behind, for example CreateWindow(), either in C or in Asm, how is it done?
Bad news, fellow, CreateWindow is made in C.
Only the innermost kernel features are made in ASM. And this is kept to a bare minimum. You could start seeing something like this downloading the linux kernel.
"In an organization, each person rises to the level of his own incompetence." Peter's Principle
|
|
|
|
|
CFileFind finder;
static const TCHAR szFileToFind[] = _T("*.dll");
Cstring Plugins[100];
int tag = 0;
bool bResult = finder.FindFile(szFileToFind);
while (bResult)
{
// Grab actual results
finder.FindNextFile();
Plugins[tag] == (LPCTSTR) finder.GetFileName();
tag++;
// Get next file
bResult = finder.FindFile(szFileToFind);
}
finder.Close();
I am away from a compiler ATM. Thanks for your help.
Darroll
Not one person lives in the present. Only the past. I can prove it.
|
|
|
|
|
The CFileFind interface is a bit wonky.
BOOL bWorking = finder.FindFile ( szFileToFind );
while ( bWorking )
{
bWorking = finder.FindNextFile();
Plugins[tag] = finder.GetFileName();
} The return value from FindNextFile() indicates whether you just got the last file in the search, which is contrary to how most classes do it (where the return indicates whether you've gone through all the files). When it returns FALSE, you still have one file left to process.
--Mike--
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Hi,
I wish to be able to delete a specifed section of my *.ini file. I have been adding things to it, but how do I delete things? I have been using the following code without the SetRegKey() function to create my .ini:
AfxGetApp()->WriteProfileString("Section", "Part", data);
I wish to delete the "Section". Code to the "Part" would also be appreaciated.
Thanks,
~ Selevercin
If you have a problem with my spelling, just remember that's not my fault. I [as well as everyone
else who learned to spell after 1976] blame it on
Robert A. Kolpek for U.S. Patent 4,136,395.
|
|
|
|
|
I have been using this to help me with ini files. http://www.codeproject.com/cpp/cinifile.asp
You could see how he does it then impliment that, or switch over and use this. It is fairly straight forward and clean. Hope this helps.
Darroll
Not one person lives in the present. Only the past. I can prove it.
|
|
|
|
|