|
char c = 0;
char str[] = "7D";
sscanf(str, "%X", &c);
printf("c = %d = 0x%X", c, c);
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Thank you very much for your reply,
I don´t kown if what you sent could be useful for my purpose, anyway I´m novice and I could be probably wrong. As long as I can see in your code I can´t create a BYTE array, only a char array. Is this correct?
My actual problem is that I have an hexadecimal Hash string (40 elements) and I need to convert this Hash to its equivalent BYTE array. 1 Byte = 2 hexadecimal characters, so I need 20 Bytes in my BYTE array.
The problem is that this Hash can´t change during the conversion!!!
I´m using some Cryptography functions (CryptCreateHash, CryptSetHashParam, CryptSignHash, etc...). I have to set the hexadecimal Hash string as the Hash to sign with the CryptSetHashParam function, but first of all I need to convert this Hash to a BYTE* element.
Thank you very much for your patient
|
|
|
|
|
One way to do it is to use strtoul() on every two characters (while specifying 16 as the base) - looping through to the end of your source of hex chars (need to check for % 2 of course). As each value is returned, you can add them to a CByteArray or a fixed sized array of bytes.
Let me know if this doesn't make sense.
|
|
|
|
|
Hello,
I have proved your solution with this code:
char *demodemoHex = "5863d9e4cbdf522eaa62e0747fceb1c5b249ba13";<br />
char **stopString;<br />
BYTE *hexArray = new BYTE[20];<br />
int j = 0;<br />
char hexChar[2];<br />
<br />
for (int i=0; i < 20; i++)<br />
{<br />
hexChar[0] = demodemoHex[j];<br />
hexChar[1] = demodemoHex[j+1];<br />
hexArray[i] = strtoul(hexChar, stopString, 16);<br />
j = j + 2;<br />
<br />
}<br />
<br />
cout << "@@@@ hexArray value visualization" << endl;<br />
for (int i = 0; i < 20; i++)<br />
{<br />
printf("%2.2x ",hexArray[i]);<br />
}
And the output is:
@@@@ hexArray value visualization
58 63 d9 e4 cb df 52 2e aa 62 e0 74 7f ce b1 c5 b2 49 ba 13
It seems to be OK!!! I´m going to prove the output hexArray with some Cryptographyc functions. I will tell you what happen.
Thank you very much!!!
|
|
|
|
|
I have proved your solution with some cryptography functions (exactly CryptSetHashParam ) and it works correctly.
Thank you very much to all the people that helped me, specially lynchspawn
|
|
|
|
|
eurosetas wrote:
I can´t create a BYTE array, only a char array...
A BYTE is nothing more than an unsigned char .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Uppss!
Thank you for the explanation!
|
|
|
|
|
what i am seeking is some guidelines.
Picture this:
I have a team developing the same application , and we use VSS.
We do not release major Versions, we distribute our application by releasing small builds, and every time i send one build to the testing people, i will wait for their feed back while my team starts new features (for the next build).
Now, if i place a "label" in VSS marking the "beta build" and my team starts woking again, the label will not do me any good because its does not reflect the build that will be sent to the customers. On the other hand if wait until i have the build ready to send to the customers, i can not place a label on VSS because the code will have changes made by my team after i send the build to testing people.
For this to work this way i would have to give "vacations" to my team whil in testing fase.
Not very good ...
How do i solve this?
How do you test a build and work on the next without multiple copies of the source code?
|
|
|
|
|
I put in a #define VERSION_NUMBER "put something here" in my stdafx.h file. Then I use VERSION_NUMBER in my about box, or anywhere else I need to use it. But maybe in your case it would be best to just check the project out each time and check it in with a comment
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
Yes , but the problem is how to control the changes that are made after the build get sent to testing.
IE:
I send a build do testing and wait for feedback.
While i am waiting, i what my team to keep working, but if they change the resources (for example), i will have no way to solve any bug in the build that was sent to the testing whitout the changes that have been made geting in to.
|
|
|
|
|
Has anyone suggested Branching?
Basically, we have the "main branch" which contains all new development. When I want to put a version into testing phase, I create a branch in a "Releases" folder and call that branch "Version A". I continue working on the main branch.
Then, in testing, version A has a problem. I can create a new project off of Version A, and make the changes only to version A. Then recompile, continue testing.
Once you confirm that you want those changes from version A in your main branch, you merge in the changes from Branch A into the Main version. Now main version has the fix you found, and your new development, but Version A is at a stable stage that it can be deployed.
PS I know you guys wrote back in May, but I was searching around for info on Source Safe Command Line stuff. Cheers.
|
|
|
|
|
Please, I need an orientation about how may I capture screen in format swf
("Flash"). I found an Unix application, vnc2swf, which make flash animations
from the VNC server data received from a machine running Windows, but, I need to do it using a C++/MFC program running on Windows...
Some sample code, any pointer, some indication?
Perhaps capturing and storing in AVI format (memory expensive) and, after,
convert it to SWF? But, how?
I dont know how or where may I search about it!
Thanks!
--
Cesario Simoes (Simões) - System Analist - Florianopolis - SC -Brazil
Cesario Simoes, jr
Working with computers since 1970 (Burroughs/GTE). Programming in assembly DSP (TMS320c2x and TMS320c5x), C and C++. Using C++ and MFC, developping GUI to telecommunication equipment (PABX, ACD, RAS, etc.)@http://www.digitro.com.br
|
|
|
|
|
Hi All,
I have an MFC application with VBA IDE incorporated in it.I am using the samples in VBA6 SDK for this.
I am facing an issue while using one particular third party ActiveX control in my applciation's VBA IDE. I am getting an error "Class not Registered" if I drag and drop this ActiveX control in the Userform. It gives an error " The Specified Procedure could not be found" if I try using CreateObject.
But the interesting thing is, it works fine in the Excel VBA IDE in the same machine.
Is there any events fired while instantiating (or drag and drop) an ActiveX control to the userform in VBA IDE?
Please help.
|
|
|
|
|
I created a splitter window with two rows and one column. I want to display different text in the two panes and also wants to have separate horizontal scroll bar for the panes.
This is the code that i have written,
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
CRect cr;
GetClientRect( &cr);
if ( !m_mainSplitter.CreateStatic( this, 2, 1,WS_HSCROLL ) )
{
MessageBox( "Error setting up splitter frames!",
"Init Error!", MB_OK | MB_ICONERROR );
return FALSE;
}
if ( !m_mainSplitter.CreateView( 0, 0,RUNTIME_CLASS(CTrialView),CSize(cr.Width(), cr.Height()/2), pContext ) )
{
MessageBox( "Error setting up splitter frames!", "Init Error!", MB_OK | MB_ICONERROR );
return FALSE;
}
if ( !m_mainSplitter.CreateView( 1, 0, RUNTIME_CLASS(CTrialView), CSize(cr.Width(), cr.Height()/2), pContext ) )
{
MessageBox( "Error setting up splitter frames!", "Init Error!", MB_OK | MB_ICONERROR );
return FALSE;
}
m_bInitSplitter = TRUE;
return TRUE;
}
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
CFrameWnd::OnSize(nType, cx, cy);
CRect cr;
GetWindowRect(&cr);
if ( m_bInitSplitter && nType != SIZE_MINIMIZED )
{
m_mainSplitter.SetRowInfo( 0, cy/2, 0 );
m_mainSplitter.SetColumnInfo( 0, cx, 50);
m_mainSplitter.RecalcLayout();
}
// TODO: Add your message handler code here
}
void CTrialView::OnDraw(CDC* pDC)
{
CTrialDoc* pDoc = GetDocument();
CRect clientRect;
GetClientRect (&clientRect);
CBrush myBrush;
CFont myFont;
CString world("Hello World");
myBrush.CreateSolidBrush ( RGB(255,255,255) );
myFont.CreateFont (25, 15, 0, 0, FW_NORMAL, 0, 0, 0, 1, 0, 0, 0, 0, "Arial");
CBrush *oldBrush = pDC->SelectObject (&myBrush);
CFont *oldFont = pDC->SelectObject (&myFont);
pDC->SetTextColor( RGB( 200 , 200 , 200 ) );
RECT rectText = { 60 , 5 , clientRect.Width() , 75 };
pDC->DrawText( world, &rectText , DT_SINGLELINE);
pDC->SelectObject (oldBrush);
pDC->SelectObject (oldFont);
myBrush.DeleteObject();
myFont.DeleteObject();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
|
|
|
|
|
I have a MFC Dialog programme,and there is no problem when I use more BUTTONs
but once I define a CBUTTON variable for a BUTTON,a problem would come
like this :
0x00000001 have a exception,there is a accessing conflict when 0xC0000005 read 0x00000001
|
|
|
|
|
don't you have 255 controls on your dialog already ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
|
humm, well, can you have a look into you Resource.h header file to see if the #define are consecutive and do coincide with your control IDs ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Doesn't it matter?
I just make everyone have a different value,it's necessary that they are consecutive?
|
|
|
|
|
yeetins wrote:
it's necessary that they are consecutive?
no, not necessary, but if you reach the end of the allow numbers, maybe it gives you an error...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I think it doesn't matter with resource.h
I'v checked it out
|
|
|
|
|
I think you need to give us more informations if you want us to help you. For example, when does this error occur ?? At the begining of your program or when you press the button, or ... ?
Did you try to use the debugger (F5) to see what instructions causes the crash ?
|
|
|
|
|
When?I don't konw.When I started,it didn't happen.
After I'v finished the program ,I need extra functions and more BUTTON,and then it happened.
the instructions that causes the crash is "CBUTTON m_BUTTON1" in the header file.
|
|
|
|
|
do you allocate memory for you button in the class constructor ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
allocate memory ?oh,I don't konw which operation can allocate memory for buttons in the class constructor?!
|
|
|
|
|