Click here to Skip to main content
16,005,241 members
Home / Discussions / C#
   

C#

 
AnswerRe: changing background color Pin
Eduard Keilholz18-Jul-07 0:12
Eduard Keilholz18-Jul-07 0:12 
QuestionParsing and edit an HTML-string Pin
anderslundsgard17-Jul-07 23:31
anderslundsgard17-Jul-07 23:31 
AnswerRe: Parsing and edit an HTML-string Pin
Martin#18-Jul-07 0:14
Martin#18-Jul-07 0:14 
AnswerRe: Parsing and edit an HTML-string Pin
Ravi Bhavnani18-Jul-07 2:20
professionalRavi Bhavnani18-Jul-07 2:20 
QuestionUDP multicast Pin
Amjath Rahman17-Jul-07 23:16
Amjath Rahman17-Jul-07 23:16 
QuestionList View search Pin
topksharma198217-Jul-07 23:10
topksharma198217-Jul-07 23:10 
AnswerRe: List View search Pin
Eduard Keilholz18-Jul-07 0:16
Eduard Keilholz18-Jul-07 0:16 
QuestionC#.net error: Attempt to read or write protected memory or often this is the indication that other memory is currupt Pin
Rao Rafique17-Jul-07 22:44
Rao Rafique17-Jul-07 22:44 
the code that causes error is boldfaced...see below the inner most loop code.

private void toolStripButton3_Click(object sender, EventArgs e)
{
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// GDI+ still lies to us - the return format is BGR, NOT RGB.
///Cover Image Code
Bitmap bmp1 = new Bitmap(textBox1.Text); ///takes image from openfiledlg textbox1

///takes an object of BitmapData & apply LocBits()
BitmapData bmp1data = bmp1.LockBits(new Rectangle(0, 0, bmp1.Width, bmp1.Height), ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb);
///finds out Bitmap's stride
int stride1 = bmp1data.Stride;
///defines pointer's to scan0 (1st byte of BimapData array
System.IntPtr Scan1 = bmp1data.Scan0;
///end of Cover Image Code
///////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

/// Stego Image code
Bitmap bmp2 = new Bitmap("f:\\bb.jpg");
BitmapData bmp2data = bmp2.LockBits(new Rectangle(0, 0, bmp2.Width, bmp2.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
int stride2 = bmp2data.Stride;
System.IntPtr Scan2 = bmp2data.Scan0;
unsafe
{
///unsafe stego code
byte* ptr2 = (byte*)(void*)Scan2;
int offset2 = stride2 - bmp2.Width * 3;
byte b2;
///end of unsafe stego
////////////////////////////////////////////////////////////////
///unsafe cover code
/// defines a byte type pointer to scan0
byte* ptr1 = null;
ptr1 = (byte*)(void*)Scan1;
/// finds offset of the BitmapData
int offset1 = stride1 - bmp1.Width * 3;
/// defines RGB values
byte b1,index=0;
bool bitt;
int x1, x2, y1, y2;

///iterates through the BitmapData
///end of unsafe cover code
////////////////////////////////////////////////////////////////
for (y2 = 0; y2 <= bmp2.Height; ++y2)
{

for (x2 = 0; x2 <= bmp2.Width; ++x2)
{
b2 = ptr2[0];


////embedding a bitt
for (y1 = 0; y1 <= bmp1.Height; y1++)
{
index = 0;
x1 = 0;
while(index<8 || x1<=bmp1.Width )
{
//////erroenous code
b1 = ptr1[0]; //gives error..access voilation
bitt = GetBit(b2, index);

/// sets LSB
ptr1[0] = SetBit(b1,6,bitt);
////end of erroneouscode //increments index by 1 ++index;
x1 = x1 + 1; ;
/// increments the pointers
ptr1 += 1;
} ///end of while
/// incremnets the pointer by offset value
ptr1 += offset1;
} ///end of outer for loop



}///3rd for loop

ptr2 += 1;
}//2nd for loop
ptr2 += offset2;
}//1st for loop

//end of unsafe1....
/// end of stego Image Code

bmp1.UnlockBits(bmp1data);
bmp2.UnlockBits(bmp2data);
/// Displays grayscale picture in picturebox.
pictureBox1.Image = bmp1;
///End of Embedding.....



}


I am getting B.S. degree in Computer Science.And want to enhance career in Software development.
QuestionCannot implicitly convert type 'test.Str.StrEnumerator' to 'System.Collections.IEnumerator'. An explicit conversion exists (are you missing a cast?) Pin
abhishek.mumbai17-Jul-07 22:42
abhishek.mumbai17-Jul-07 22:42 
AnswerRe: Cannot implicitly convert type 'test.Str.StrEnumerator' to 'System.Collections.IEnumerator'. An explicit conversion exists (are you missing a cast?) Pin
J4amieC17-Jul-07 23:09
J4amieC17-Jul-07 23:09 
AnswerRe: Cannot implicitly convert type 'test.Str.StrEnumerator' to 'System.Collections.IEnumerator'. An explicit conversion exists (are you missing a cast?) Pin
Colin Angus Mackay17-Jul-07 23:10
Colin Angus Mackay17-Jul-07 23:10 
QuestionHow do you know the current level of datagrid when nested Pin
Muammar©17-Jul-07 22:33
Muammar©17-Jul-07 22:33 
QuestionBuild solution using NAnt [modified] Pin
deep717-Jul-07 22:31
deep717-Jul-07 22:31 
AnswerRe: Build solution using NAnt Pin
Scott Dorman18-Jul-07 7:24
professionalScott Dorman18-Jul-07 7:24 
QuestionC#.net error: Attempt to read or write protected memory or often this is the indication that other memory is currupt Pin
Rao Rafique17-Jul-07 22:15
Rao Rafique17-Jul-07 22:15 
AnswerRe: C#.net error: Attempt to read or write protected memory or often this is the indication that other memory is currupt Pin
Guffa17-Jul-07 22:21
Guffa17-Jul-07 22:21 
QuestionHow to Export an Excel (xls) document that's compatible to all office versions - C# Pin
OhrmaZd17-Jul-07 22:00
OhrmaZd17-Jul-07 22:00 
AnswerRe: How to Export an Excel (xls) document that's compatible to all office versions - C# Pin
originSH17-Jul-07 22:12
originSH17-Jul-07 22:12 
AnswerRe: How to Export an Excel (xls) document that's compatible to all office versions - C# Pin
DavieL17-Jul-07 22:30
DavieL17-Jul-07 22:30 
GeneralRe: How to Export an Excel (xls) document that's compatible to all office versions - C# Pin
OhrmaZd17-Jul-07 23:47
OhrmaZd17-Jul-07 23:47 
QuestionReport problem Pin
manoj_ce17-Jul-07 21:26
manoj_ce17-Jul-07 21:26 
QuestionVerify Certificate Revocation using x509chain offline check Pin
suprajav17-Jul-07 20:52
suprajav17-Jul-07 20:52 
QuestionSetting Focus problem... Pin
Dotnetkanna17-Jul-07 20:31
Dotnetkanna17-Jul-07 20:31 
Question.Net 2.0 Pin
razanabanu17-Jul-07 20:20
razanabanu17-Jul-07 20:20 
AnswerRe: .Net 2.0 Pin
Michael Sync17-Jul-07 20:33
Michael Sync17-Jul-07 20:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.