Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6007151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:38:26+00:00 2026-05-23T01:38:26+00:00

I have connected a photographic flash unit to my computer using a relay switch

  • 0

I have connected a photographic flash unit to my computer using a relay switch connected to the serial port. The following code causes the strobe to flash at 4Hz for 10 flashes:

#include <windows.h>

//Initialise Windows module
int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil)

{
 //Define the serial port precedure    
 HANDLE hSerial;

 int freq = 4;
 int iterations = 10;
 int x;

 for ( x = 0; x < iterations; x++)
 {
 //Fire the flash (open the serial port, and immediately close it)
 hSerial = CreateFile("COM1",GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
 CloseHandle(hSerial);

 //Sleep in between flashes for specified duration
 Sleep (1000/freq);
 }

 return 0;
}

How do I implement dialog boxes at the beginning of the program so that the user can input the values of ‘freq’ and ‘iterations’?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:38:27+00:00Added an answer on May 23, 2026 at 1:38 am
    1. Open Visual Studio, New, Project,
      Visual C++, Windows Forms
      Application. This will give you a
      GUI where you can drag and drop what
      you need. If you don’t have Visual
      Studio then perhaps your IDE has
      something similar?

    2. Make this a console app that accepts the data in the command line. Call the app with an appropriate command line from a GUI created in any other programming language/ framework.

    3. Make the GUI in C# and use P/Invoke to call CreateFile; it’s not that hard.

    Btw, does the CreateFile/CloseHandle approach really work? I find it to be a bit “hacky” and I’m not sure it’s the best approach. Perhaps another answer or a comment will touch this aspect as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, I have connected to an IP address using the following code: IPAddress myIpAddress
I'm using Code::Blocks on Ubuntu 10.10 (Maverick Meerkat). I have connected a Mac keyboard
I have connected to a server via SFTP using FileZilla and accepted adding the
(How long have we been using OpenIDs? I don't seem to have one connected
Suppose, I have a connected socket after writing this code.. if ((sd = accept(socket_d,
I have a GSM modem connected via USB. The modem creates 2 serial ports.
I have connected Java program to Oracle database using JDBC. I want to store
I have connected to a database using ODBC in an unicode MFC Application and
i have connected several machines with server using VPN and i have a URL
I have an issue where i have connected my linux server to a serial

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.