
    Ex parte Cory HOWARD.
    No. 04-05-00157-CR.
    Court of Appeals of Texas, San Antonio.
    Nov. 28, 2005.
    Rehearing Overruled Feb. 16, 2006.
    
      George Scharmen, San Antonio, for appellant.
    Kevin P. Yeary, Asst. Crim. Dist. Atty., San Antonio, for appellee.
    Sitting: CATHERINE STONE, Justice, SARAH B. DUNCAN, Justice, REBECCA SIMMONS, Justice.
   MEMORANDUM OPINION

Opinion by

CATHERINE STONE, Justice.

In this appeal, Cory Howard seeks reversal of the trial court’s denial of his application for a pretrial writ of habeas corpus. Because the ground asserted in the petition for writ of habeas corpus is not cognizable in a pretrial writ application, we affirm the trial court’s denial of habeas corpus relief.

A writ of habeas corpus is an extraordinary writ. Ex parte Weise, 55 S.W.3d 617, 619 (Tex.Crim.App.2001). “Neither a trial court nor an appellate court should entertain an application for writ of habeas corpus when there is an adequate remedy by appeal.” Id. Further, an applicant must be illegally restrained to be entitled to habeas corpus relief. Id. “If we conclude the grounds asserted in the petition for writ of habeas corpus are not cognizable, then we must affirm the trial court’s denial of habeas corpus relief.” Ex parte Schoolcraft, 107 S.W.3d 674, 676 (Tex.App.-San Antonio 2003, no pet.).

Howard is charged with committing the offense of driving while intoxicated on September 8, 2003. The indictment alleges that Howard has been convicted of DWI on two previous occasions, January 19, 1989 and October 14, 1991. The effect of this allegation is to change the primary DWI offense from a misdemeanor to a third-degree felony. Howard filed a pretrial writ of habeas corpus, asserting that his previous DWI convictions cannot be used for enhancement purposes because the statutory language permitting such enhancement did not exist at the time of his previous convictions. According to Howard, using his prior convictions to increase the punishment for his 2003 DWI offense would thus violate the ex post facto proscriptions of the United States and Texas Constitutions.

Howard’s complaint is plainly an “as applied” challenge to the constitutionality of the enhancement statute in effect at the time of the primary DWI offense— Penal Code section 49.09(e). See Ex parte Woodall, 154 S.W.3d 698, 700-01 (Tex. App.-El Paso 2004, pet. ref d) (recognizing argument alleging that a city ordinance is unconstitutional because it is an ex post facto law is “an ‘as applied’ challenge to the constitutionality of the ... ordinance.”). A pretrial writ of habeas corpus, however, may not be used to address an “as applied” challenge to a statute. Id. at 701. “As applied” challenges must be litigated in the trial court and adjudicated on direct appeal. Id. Because the issue raised in Howard’s petition for writ of habeas corpus is not cognizable in a pretrial writ application, Howard’s sole appellate issue is overruled.

The order of the trial court denying habeas corpus relief is affirmed. 
      
      . The offense of driving while intoxicated is generally a misdemeanor. Tex. Pen.Code Ann. § 49.04 (Vernon 2003). The offense becomes a third-degree felony if the defendant has previously been convicted two times of any offense relating to the operating of a motor vehicle while intoxicated. Id. § 49.09(b)(2) (Vernon Supp.2004-2005).
     
      
      . At the time of Howard’s indictment for the primary DWI offense, a conviction could not be used for purposes of enhancement if:
      (1) the conviction was a final conviction under Subsection (d);
      (2) the offense for which the person is being tried was committed more than 10 years after the latest of:
      (A) the date on which the judgment was entered for the previous conviction;
      (B) the date on which the person was discharged from any period of community supervision on which the person was placed for the previous conviction;
      (C) the date on which the person successfully completed any period of parole on which the person was released after serving a portion of the term to which the person was sentenced for the previous conviction; or
      (D) the date on which the person completed serving any term for which the person was confined or imprisoned for the previ-qus conviction; and
      (3)the person has not been convicted of an offense under Section 49.04, 49.05, 49.06, 49.065, 49.07, or 49.08 or any offense related to operating a motor vehicle while intoxicated within 10 years of the latest date under Subdivision (2).
      Tex. Pen.Code Ann. § 49.09(e) (Vernon 2003). By contrast, at the time of Howard’s conviction for DWI on October 14, 1991, a conviction could not be used for purposes of enhancement if:
      (1) the conviction was a final conviction under the provisions of Subsections (g) and
      (h) of this article and was for an offense committed more than 10 years before the offense for which the person is being tried was committed; and
      (2) the person has not been convicted of an offense under Subdivision (2), Subsection
      (a), Section 19.05, Penal Code, or Article 6701Z-1, or Article 6701Z-2, Revised Statutes, committed within 10 years immediately preceding the date on which the offense for which the person is being tried was committed.
      Act of June 16, 1983, 68th Leg., R.S., ch. 303, § 3, 1983 Tex. Gen. Laws 1568, 1576, repealed by Act of June 19, 1993, 73d Leg., R.S., ch. 900, § 1.15, 1993 Tex. Gen. Laws 3586, 3704.
     